Debian Codegraph @

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

raw
1 // PR c++/94034
2 // { dg-do compile { target c++14 } }
3
4 struct A {
5 A() = default; A(const A&);
6 A *ap = this;
7 };
8
9 constexpr A foo()
10 {
11 return {};
12 }
13
14 constexpr A bar()
15 {
16 return foo();
17 }
18
19 void
20 baz()
21 {
22 constexpr A a = foo(); // { dg-error ".A..& a... is not a constant expression" }
23 constexpr A b = bar(); // { dg-error ".A..& b... is not a constant expression" }
24 }
25
26 constexpr A a = foo();
27 constexpr A b = bar();