[mlir] Fix typo in test vector transform pass descriptions (#118194)
[llvm-project.git] / clang / test / SemaCXX / constexpr-subobj-initialization.cpp
blobf0252df1e2ce1461e70b4adc29b42d6adb320094
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2 // RUN: %clang_cc1 -fsyntax-only -verify -fexperimental-new-constant-interpreter %s
4 namespace baseclass_uninit {
5 struct DelBase {
6 constexpr DelBase() = delete; // expected-note {{'DelBase' has been explicitly marked deleted here}}
7 };
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}}
13 struct Bar : Foo {
14 constexpr Bar() {};
16 constexpr Bar bar; // expected-error {{must be initialized by a constant expression}}
18 struct Base {};
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
33 struct Foo {
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 {
41 int i;
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>
49 struct Baz {
50 constexpr Baz(); // expected-note {{declared here}}
53 struct 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}}
58 constexpr Quux qx; // expected-error {{must be initialized by a constant expression}} \
59 // expected-note {{in call to 'Quux()'}}