1 // RUN: %clang_cc1 -fsyntax-only -verify %s -fexperimental-new-constant-interpreter
3 /// This is like the version in test/SemaCXX/, but some of the
4 /// output types and their location has been adapted.
6 /// 1) The type of the uninitialized base class is printed WITH the namespace,
7 /// i.e. 'baseclass_uninit::DelBase' instead of just 'DelBase'.
10 namespace baseclass_uninit
{
12 constexpr DelBase() = delete; // expected-note {{'DelBase' has been explicitly marked deleted here}}
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'}}
18 constexpr Foo f
; // expected-error {{must be initialized by a constant expression}}
23 constexpr Bar bar
; // expected-error {{must be initialized by a constant expression}}
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}}
30 constexpr A a
; // expected-error {{must be initialized by a constant expression}}
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}}
37 constexpr B b
; // expected-error {{must be initialized by a constant expression}}
38 } // namespace baseclass_uninit
42 constexpr Foo(); // expected-note 2{{declared here}}
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}}
48 struct Bar
: protected Foo
{
50 constexpr Bar() : i(12) {} // expected-note {{undefined constructor 'Foo' cannot be used in a constant expression}}
53 constexpr Bar bb
; // expected-error {{must be initialized by a constant expression}} \
54 // expected-note {{in call to 'Bar()'}}
56 template <typename Ty
>
58 constexpr Baz(); // expected-note {{declared here}}
61 struct Quux
: Baz
<Foo
>, private Bar
{
63 constexpr Quux() : i(12) {} // expected-note {{undefined constructor 'Baz' cannot be used in a constant expression}}
66 constexpr Quux qx
; // expected-error {{must be initialized by a constant expression}} \
67 // expected-note {{in call to 'Quux()'}}