Mercurial > hg > CbC > CbC_gcc
comparison gcc/testsuite/g++.dg/cpp2a/paren-init2.C @ 145:1830386684a0
gcc-9.2.0
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 11:34:05 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
131:84e7813d76e9 | 145:1830386684a0 |
---|---|
1 // PR c++/91363 - P0960R3: Parenthesized initialization of aggregates. | |
2 // { dg-do run { target c++2a } } | |
3 | |
4 struct A { | |
5 int i = 0; | |
6 int j = 0; | |
7 }; | |
8 | |
9 struct B { | |
10 A a; | |
11 constexpr B() : a(1.1, 2) { } | |
12 }; | |
13 | |
14 struct C { | |
15 int i; | |
16 }; | |
17 | |
18 struct E { | |
19 C c; | |
20 E() : c(1.2) { } | |
21 }; | |
22 | |
23 struct F { | |
24 char a[4]; | |
25 }; | |
26 | |
27 struct G { | |
28 F f; | |
29 G() : f("yew") { } | |
30 }; | |
31 | |
32 struct H { | |
33 int i; | |
34 int &&r; | |
35 }; | |
36 | |
37 int f() { return 42; } | |
38 | |
39 struct I { | |
40 H h; | |
41 I() : h(1, f()) { } | |
42 }; | |
43 | |
44 I i; // dangling ref to f(): | |
45 // {.i=1, .r=(int &) &TARGET_EXPR <D.2118, f ()>} | |
46 | |
47 int | |
48 main () | |
49 { | |
50 B b; | |
51 if (b.a.i != 1 || b.a.j != 2) | |
52 __builtin_abort (); | |
53 E e; | |
54 if (e.c.i != 1) | |
55 __builtin_abort (); | |
56 } |