Debian Codegraph @

gcc/testsuite/g++.dg/cpp23/constexpr-nonlit14.C

raw
1 // PR c++/106649
2 // P2448 - Relaxing some constexpr restrictions
3 // { dg-do compile { target c++20 } }
4 // { dg-options "" }
5 // The definition of a constexpr destructor whose function-body is not
6 // =delete shall additionally satisfy the following requirement:
7 // (5.1) for every subobject of class type or (possibly multi-dimensional)
8 // array thereof, that class type shall have a constexpr destructor.
9
10 struct B {
11 B() { }
12 ~B() { }
13 };
14
15 struct T : B {
16 constexpr ~T() { } // { dg-warning "call to" "" { target c++20_down } }
17 };
18
19 struct S {
20 constexpr S() = default; // was error: implicit S() is not constexpr, now OK
21 ~S() noexcept(false) = default; // OK, despite mismatched exception specification
22 private:
23 int i;
24 S(S&); // OK: private copy constructor
25 };
26 S::S(S&) = default; // OK: defines copy constructor