1*24c91d44STakuya Shimizu // RUN: %clang_cc1 -fsyntax-only -verify %s 2*24c91d44STakuya Shimizu 3*24c91d44STakuya Shimizu namespace baseclass_uninit { 4*24c91d44STakuya Shimizu struct DelBase { 5*24c91d44STakuya Shimizu constexpr DelBase() = delete; // expected-note {{'DelBase' has been explicitly marked deleted here}} 6*24c91d44STakuya Shimizu }; 7*24c91d44STakuya Shimizu 8*24c91d44STakuya Shimizu struct Foo : DelBase { // expected-note 2{{constructor of base class 'DelBase' is not called}} 9*24c91d44STakuya Shimizu constexpr Foo() {}; // expected-error {{call to deleted constructor of 'DelBase'}} 10*24c91d44STakuya Shimizu }; 11*24c91d44STakuya Shimizu constexpr Foo f; // expected-error {{must be initialized by a constant expression}} 12*24c91d44STakuya Shimizu struct Bar : Foo { 13*24c91d44STakuya Shimizu constexpr Bar() {}; 14*24c91d44STakuya Shimizu }; 15*24c91d44STakuya Shimizu constexpr Bar bar; // expected-error {{must be initialized by a constant expression}} 16*24c91d44STakuya Shimizu 17*24c91d44STakuya Shimizu struct Base {}; 18*24c91d44STakuya Shimizu struct A : Base { // expected-note {{constructor of base class 'Base' is not called}} 19*24c91d44STakuya Shimizu constexpr A() : value() {} // expected-error {{member initializer 'value' does not name a non-static data member or base class}} 20*24c91d44STakuya Shimizu }; 21*24c91d44STakuya Shimizu 22*24c91d44STakuya Shimizu constexpr A a; // expected-error {{must be initialized by a constant expression}} 23*24c91d44STakuya Shimizu 24*24c91d44STakuya Shimizu struct B : Base { // expected-note {{constructor of base class 'Base' is not called}} 25*24c91d44STakuya Shimizu constexpr B() : {} // expected-error {{expected class member or base class name}} 26*24c91d44STakuya Shimizu }; 27*24c91d44STakuya Shimizu 28*24c91d44STakuya Shimizu constexpr B b; // expected-error {{must be initialized by a constant expression}} 29*24c91d44STakuya Shimizu } // namespace baseclass_uninit 30*24c91d44STakuya Shimizu 31*24c91d44STakuya Shimizu 32*24c91d44STakuya Shimizu struct Foo { 33*24c91d44STakuya Shimizu constexpr Foo(); // expected-note 2{{declared here}} 34*24c91d44STakuya Shimizu }; 35*24c91d44STakuya Shimizu 36*24c91d44STakuya Shimizu constexpr Foo ff; // expected-error {{must be initialized by a constant expression}} \ 37*24c91d44STakuya Shimizu // expected-note {{undefined constructor 'Foo' cannot be used in a constant expression}} 38*24c91d44STakuya Shimizu 39*24c91d44STakuya Shimizu struct Bar : protected Foo { 40*24c91d44STakuya Shimizu int i; 41*24c91d44STakuya Shimizu constexpr Bar() : i(12) {} // expected-note {{undefined constructor 'Foo' cannot be used in a constant expression}} 42*24c91d44STakuya Shimizu }; 43*24c91d44STakuya Shimizu 44*24c91d44STakuya Shimizu constexpr Bar bb; // expected-error {{must be initialized by a constant expression}} \ 45*24c91d44STakuya Shimizu // expected-note {{in call to 'Bar()'}} 46*24c91d44STakuya Shimizu 47*24c91d44STakuya Shimizu template <typename Ty> 48*24c91d44STakuya Shimizu struct Baz { 49*24c91d44STakuya Shimizu constexpr Baz(); // expected-note {{declared here}} 50*24c91d44STakuya Shimizu }; 51*24c91d44STakuya Shimizu 52*24c91d44STakuya Shimizu struct Quux : Baz<Foo>, private Bar { 53*24c91d44STakuya Shimizu int i; 54*24c91d44STakuya Shimizu constexpr Quux() : i(12) {} // expected-note {{undefined constructor 'Baz' cannot be used in a constant expression}} 55*24c91d44STakuya Shimizu }; 56*24c91d44STakuya Shimizu 57*24c91d44STakuya Shimizu constexpr Quux qx; // expected-error {{must be initialized by a constant expression}} \ 58*24c91d44STakuya Shimizu // expected-note {{in call to 'Quux()'}} 59