1 // RUN: %clang_cc1 -std=c++2a -verify=expected,cxx2a %s
2 // RUN: %clang_cc1 -std=c++23 -verify=expected %s
4 // p3: if the function is a constructor or destructor, its class shall not have
5 // any virtual base classes;
8 struct B
: virtual A
{ // expected-note {{virtual}}
9 constexpr ~B() {} // expected-error {{constexpr member function not allowed in struct with virtual base class}}
17 goto x
; // cxx2a-warning {{use of this statement in a constexpr function is a C++23 extension}}
23 x
:; // cxx2a-warning {{use of this statement in a constexpr function is a C++23 extension}}
26 struct Nonlit
{ // cxx2a-note {{'Nonlit' is not literal because}}
32 Nonlit nl
; // cxx2a-error {{variable of non-literal type 'Nonlit' cannot be defined in a constexpr function before C++23}}
38 static int a
; // cxx2a-warning {{definition of a static variable in a constexpr function is a C++23 extension}}
44 thread_local
int e
; // cxx2a-warning {{definition of a thread_local variable in a constexpr function is a C++23 extension}}
55 // p5: for every subobject of class type or (possibly multi-dimensional) array
56 // thereof, that class type shall have a constexpr destructor
61 struct B
: A
{ // cxx2a-note {{here}}
62 constexpr ~B() {} // cxx2a-error {{destructor cannot be declared constexpr because base class 'A' does not have a constexpr destructor}}
65 A a
; // cxx2a-note {{here}}
66 constexpr ~C() {} // cxx2a-error {{destructor cannot be declared constexpr because data member 'a' does not have a constexpr destructor}}
70 constexpr ~D() = delete;