Daily bump.
[official-gcc.git] / gcc / testsuite / g++.dg / cpp2a / constexpr-dtor5.C
blob1739afbcc680d9444038ef45a26c8e6ff5f14837
1 // PR c++/97388
2 // { dg-do compile { target c++20 } }
4 struct S {
5   int m;
6   constexpr S () : m(1) {}
7   constexpr ~S () noexcept (false) { if (m == 1) { throw; } }
8 };
10 constexpr bool
11 foo (S v)
13   v.m = 2;
14   return true;
17 constexpr bool
18 bar ()
20   return foo (S ());
23 constexpr bool
24 baz ()
26   foo (S ());
27   return foo (S ());
30 static_assert (foo (S ()));
31 static_assert (bar ());
32 static_assert (baz ());
33 constexpr bool x = foo (S ());
34 constexpr bool y = bar ();
35 constexpr bool z = baz ();