xref: /llvm-project/clang/test/SemaCXX/constexpr-default-init-value-crash.cpp (revision f1128f3782363ca26e0bdf9323a0d16570dcfba0)
1 // RUN: %clang_cc1 %s -std=c++20 -fsyntax-only -verify
2 // RUN: %clang_cc1 %s -std=c++20 -fsyntax-only -verify -fno-recovery-ast
3 // RUN: %clang_cc1 %s -std=c++20 -fsyntax-only -verify -fexperimental-new-constant-interpreter
4 // RUN: %clang_cc1 %s -std=c++20 -fsyntax-only -verify -fno-recovery-ast -fexperimental-new-constant-interpreter
5 
6 
7 namespace NoCrash {
8 struct ForwardDecl; // expected-note {{forward declaration of}}
9 struct Foo {        // expected-note 2{{candidate constructor}}
10   ForwardDecl f;    // expected-error {{field has incomplete type}}
11 };
12 
getFoo()13 constexpr Foo getFoo() {
14   Foo e = 123; // expected-error {{no viable conversion from 'int' to 'Foo'}}
15   return e;
16 }
17 }
18