1 // RUN: %clang_cc1 -fsyntax-only -verify %s -fexperimental-new-constant-interpreter 2 3 /// This is like the version in test/SemaCXX/, but some of the 4 /// output types and their location has been adapted. 5 /// Differences: 6 /// 1) The type of the uninitialized base class is printed WITH the namespace, 7 /// i.e. 'baseclass_uninit::DelBase' instead of just 'DelBase'. 8 9 10 namespace baseclass_uninit { 11 struct DelBase { 12 constexpr DelBase() = delete; // expected-note {{'DelBase' has been explicitly marked deleted here}} 13 }; 14 15 struct Foo : DelBase { // expected-note 2{{constructor of base class 'baseclass_uninit::DelBase' is not called}} 16 constexpr Foo() {}; // expected-error {{call to deleted constructor of 'DelBase'}} 17 }; 18 constexpr Foo f; // expected-error {{must be initialized by a constant expression}} 19 20 struct Bar : Foo { 21 constexpr Bar() {}; 22 }; 23 constexpr Bar bar; // expected-error {{must be initialized by a constant expression}} 24 25 struct Base {}; 26 struct A : Base { // expected-note {{constructor of base class 'baseclass_uninit::Base' is not called}} 27 constexpr A() : value() {} // expected-error {{member initializer 'value' does not name a non-static data member or base class}} 28 }; 29 30 constexpr A a; // expected-error {{must be initialized by a constant expression}} 31 32 33 struct B : Base { // expected-note {{constructor of base class 'baseclass_uninit::Base' is not called}} 34 constexpr B() : {} // expected-error {{expected class member or base class name}} 35 }; 36 37 constexpr B b; // expected-error {{must be initialized by a constant expression}} 38 } // namespace baseclass_uninit 39 40 41 struct Foo { 42 constexpr Foo(); // expected-note 2{{declared here}} 43 }; 44 45 constexpr Foo ff; // expected-error {{must be initialized by a constant expression}} \ 46 // expected-note {{undefined constructor 'Foo' cannot be used in a constant expression}} 47 48 struct Bar : protected Foo { 49 int i; 50 constexpr Bar() : i(12) {} // expected-note {{undefined constructor 'Foo' cannot be used in a constant expression}} 51 }; 52 53 constexpr Bar bb; // expected-error {{must be initialized by a constant expression}} \ 54 // expected-note {{in call to 'Bar()'}} 55 56 template <typename Ty> 57 struct Baz { 58 constexpr Baz(); // expected-note {{declared here}} 59 }; 60 61 struct Quux : Baz<Foo>, private Bar { 62 int i; 63 constexpr Quux() : i(12) {} // expected-note {{undefined constructor 'Baz' cannot be used in a constant expression}} 64 }; 65 66 constexpr Quux qx; // expected-error {{must be initialized by a constant expression}} \ 67 // expected-note {{in call to 'Quux()'}} 68