Debian Codegraph @

gcc/testsuite/g++.dg/cpp2a/consteval14.C

raw
1 // { dg-do compile }
2 // { dg-options "-std=c++2a" }
3
4 struct S { consteval S () : a (1), b (2) { a++; b++; } consteval S (int x) : a (x), b (x) { a++; b--; } int a, b; };
5 S c;
6
7 template <int N>
8 int
9 foo ()
10 {
11 S a;
12 a.b++;
13 c = a;
14 S b = 12;
15 c.a += b.a;
16 c.b += b.b;
17 S e[2];
18 S f[2] = { 1, 2 };
19 const S g;
20 c.a += g.a;
21 c.b += g.b;
22 const S h = 12;
23 c.a += h.a;
24 c.b += h.b;
25 const S i[2];
26 const S j[2] = { 1, 2 };
27 return S ().a + e[1].a + f[0].b + i[0].a + j[1].b;
28 }
29
30 int x = foo <2> ();