1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2 // RUN: %clang_cc1 -fsyntax-only -verify -fexperimental-new-constant-interpreter %s
4 namespace baseclass_uninit
{
6 constexpr DelBase() = delete; // expected-note {{'DelBase' has been explicitly marked deleted here}}
9 struct Foo
: DelBase
{ // expected-note-re 2{{constructor of base class '{{.*}}DelBase' is not called}}
10 constexpr Foo() {}; // expected-error {{call to deleted constructor of 'DelBase'}}
12 constexpr Foo f
; // expected-error {{must be initialized by a constant expression}}
16 constexpr Bar bar
; // expected-error {{must be initialized by a constant expression}}
19 struct A
: Base
{ // expected-note-re {{constructor of base class '{{.*}}Base' is not called}}
20 constexpr A() : value() {} // expected-error {{member initializer 'value' does not name a non-static data member or base class}}
23 constexpr A a
; // expected-error {{must be initialized by a constant expression}}
25 struct B
: Base
{ // expected-note-re {{constructor of base class '{{.*}}Base' is not called}}
26 constexpr B() : {} // expected-error {{expected class member or base class name}}
29 constexpr B b
; // expected-error {{must be initialized by a constant expression}}
30 } // namespace baseclass_uninit
34 constexpr Foo(); // expected-note 2{{declared here}}
37 constexpr Foo ff
; // expected-error {{must be initialized by a constant expression}} \
38 // expected-note {{undefined constructor 'Foo' cannot be used in a constant expression}}
40 struct Bar
: protected Foo
{
42 constexpr Bar() : i(12) {} // expected-note {{undefined constructor 'Foo' cannot be used in a constant expression}}
45 constexpr Bar bb
; // expected-error {{must be initialized by a constant expression}} \
46 // expected-note {{in call to 'Bar()'}}
48 template <typename Ty
>
50 constexpr Baz(); // expected-note {{declared here}}
53 struct Quux
: Baz
<Foo
>, private Bar
{
55 constexpr Quux() : i(12) {} // expected-note {{undefined constructor 'Baz' cannot be used in a constant expression}}
58 constexpr Quux qx
; // expected-error {{must be initialized by a constant expression}} \
59 // expected-note {{in call to 'Quux()'}}