Debian Codegraph @

gcc/testsuite/g++.dg/cpp1y/constexpr-nsdmi6a.C

raw
1 // PR c++/94034
2 // { dg-do compile { target c++14 } }
3
4 struct A {
5 A *ap = this;
6 };
7
8 constexpr A foo()
9 {
10 return {};
11 }
12
13 constexpr A bar()
14 {
15 return foo();
16 }
17
18 void
19 baz()
20 {
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" }
23 }
24
25 constexpr A a = foo();
26 constexpr A b = bar();