llvm-for-llvmta/tools/clang/test/SemaCXX/constexpr-default-init-valu...

15 lines
477 B
C++
Raw Normal View History

2022-04-25 13:02:35 +02:00
// RUN: %clang_cc1 %s -std=c++20 -fsyntax-only -verify
// RUN: %clang_cc1 %s -std=c++20 -fsyntax-only -verify -fno-recovery-ast
namespace NoCrash {
struct ForwardDecl; // expected-note {{forward declaration of}}
struct Foo { // expected-note 2{{candidate constructor}}
ForwardDecl f; // expected-error {{field has incomplete type}}
};
constexpr Foo getFoo() {
Foo e = 123; // expected-error {{no viable conversion from 'int' to 'NoCrash::Foo'}}
return e;
}
}