c++: robustify testcase [PR109752]
[official-gcc.git] / gcc / testsuite / g++.dg / cpp1y / constexpr-nsdmi6a.C
blobbb844b952e28d976bdc4c6b0cf6e5b68c8bc59c2
1 // PR c++/94034
2 // { dg-do compile { target c++14 } }
4 struct A {
5   A *ap = this;
6 };
8 constexpr A foo()
10   return {};
13 constexpr A bar()
15   return foo();
18 void
19 baz()
21   constexpr A a = foo(); // { dg-error ".A..& a... is not a constant expression" }
22   constexpr A b = bar(); // { dg-error ".A..& b... is not a constant expression" }
25 constexpr A a = foo();
26 constexpr A b = bar();