[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / SemaCXX / invalid-constructor-init.cpp
blob8460a379f9bb853031258931496c2b84cfdaeea4
1 // RUN: %clang_cc1 -frecovery-ast -verify %s
3 struct X {
4 int Y;
5 constexpr X()
6 : Y(foo()) {} // expected-error {{use of undeclared identifier 'foo'}}
7 };
8 // no crash on evaluating the constexpr ctor.
9 constexpr int Z = X().Y; // expected-error {{constexpr variable 'Z' must be initialized by a constant expression}}
11 struct X2 {
12 int Y = foo(); // expected-error {{use of undeclared identifier 'foo'}}
13 constexpr X2() {}
16 struct X3 {
17 int Y;
18 constexpr X3()
19 : Y(({foo();})) {} // expected-error {{use of undeclared identifier 'foo'}}
22 struct CycleDelegate {
23 int Y;
24 CycleDelegate(int)
25 : Y(foo()) {} // expected-error {{use of undeclared identifier 'foo'}}
26 // no bogus "delegation cycle" diagnostic
27 CycleDelegate(float) : CycleDelegate(1) {}
30 struct X4 {
31 int* p = new int(invalid()); // expected-error {{use of undeclared identifier}}
33 // no crash on evaluating the CXXDefaultInitExpr.
34 constexpr int* s = X4().p; // expected-error {{must be initialized by}}