brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.2 KiB · f0252df Raw
60 lines · cpp
1// RUN: %clang_cc1 -fsyntax-only -verify %s2// RUN: %clang_cc1 -fsyntax-only -verify -fexperimental-new-constant-interpreter %s3 4namespace baseclass_uninit {5struct DelBase {6  constexpr DelBase() = delete; // expected-note {{'DelBase' has been explicitly marked deleted here}}7};8 9struct 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'}}11};12constexpr Foo f; // expected-error {{must be initialized by a constant expression}}13struct Bar : Foo {14  constexpr Bar() {};15};16constexpr Bar bar; // expected-error {{must be initialized by a constant expression}}17 18struct Base {};19struct 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}}21};22 23constexpr A a; // expected-error {{must be initialized by a constant expression}}24 25struct 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}}27};28 29constexpr B b; // expected-error {{must be initialized by a constant expression}}30} // namespace baseclass_uninit31 32 33struct Foo {34  constexpr Foo(); // expected-note 2{{declared here}}35};36 37constexpr Foo ff; // expected-error {{must be initialized by a constant expression}} \38                  // expected-note {{undefined constructor 'Foo' cannot be used in a constant expression}}39 40struct Bar : protected Foo {41  int i;42  constexpr Bar() : i(12) {} // expected-note {{undefined constructor 'Foo' cannot be used in a constant expression}}43};44 45constexpr Bar bb; // expected-error {{must be initialized by a constant expression}} \46                  // expected-note {{in call to 'Bar()'}}47 48template <typename Ty>49struct Baz {50  constexpr Baz(); // expected-note {{declared here}}51};52 53struct Quux : Baz<Foo>, private Bar {54  int i;55  constexpr Quux() : i(12) {} // expected-note {{undefined constructor 'Baz' cannot be used in a constant expression}}56};57 58constexpr Quux qx; // expected-error {{must be initialized by a constant expression}} \59                   // expected-note {{in call to 'Quux()'}}60