1 // RUN: %clang_cc1 -fsyntax-only -verify %s
3 namespace baseclass_uninit
{
5 constexpr DelBase() = delete; // expected-note {{'DelBase' has been explicitly marked deleted here}}
8 struct Foo
: DelBase
{ // expected-note 2{{constructor of base class 'DelBase' is not called}}
9 constexpr Foo() {}; // expected-error {{call to deleted constructor of 'DelBase'}}
11 constexpr Foo f
; // expected-error {{must be initialized by a constant expression}}
15 constexpr Bar bar
; // expected-error {{must be initialized by a constant expression}}
18 struct A
: Base
{ // expected-note {{constructor of base class 'Base' is not called}}
19 constexpr A() : value() {} // expected-error {{member initializer 'value' does not name a non-static data member or base class}}
22 constexpr A a
; // expected-error {{must be initialized by a constant expression}}
24 struct B
: Base
{ // expected-note {{constructor of base class 'Base' is not called}}
25 constexpr B() : {} // expected-error {{expected class member or base class name}}
28 constexpr B b
; // expected-error {{must be initialized by a constant expression}}
29 } // namespace baseclass_uninit
33 constexpr Foo(); // expected-note 2{{declared here}}
36 constexpr Foo ff
; // expected-error {{must be initialized by a constant expression}} \
37 // expected-note {{undefined constructor 'Foo' cannot be used in a constant expression}}
39 struct Bar
: protected Foo
{
41 constexpr Bar() : i(12) {} // expected-note {{undefined constructor 'Foo' cannot be used in a constant expression}}
44 constexpr Bar bb
; // expected-error {{must be initialized by a constant expression}} \
45 // expected-note {{in call to 'Bar()'}}
47 template <typename Ty
>
49 constexpr Baz(); // expected-note {{declared here}}
52 struct Quux
: Baz
<Foo
>, private Bar
{
54 constexpr Quux() : i(12) {} // expected-note {{undefined constructor 'Baz' cannot be used in a constant expression}}
57 constexpr Quux qx
; // expected-error {{must be initialized by a constant expression}} \
58 // expected-note {{in call to 'Quux()'}}