PR c++/56973, DR 696 - capture constant variables only as needed.
[official-gcc.git] / gcc / testsuite / g++.dg / cpp1y / constexpr-copy3.C
blobcce4b54df7f6360d032857abdca2735a335e411d
1 // PR c++/69995
2 // { dg-do compile { target c++14 } }
4 struct A
6   int i;
7 };
9 constexpr int f(A a)
11   ++a.i;
12   return a.i;
15 constexpr bool g()
17   A a = { 42 };
18   A b = a;
19   ++b.i;
20   if (b.i != 43) return false;
21   if (a.i != 42) return false;
22   return true;
25 #define SA(X) static_assert((X),#X)
26 SA(g());