Debian Codegraph @

gcc/testsuite/g++.dg/cpp1z/aggr-base9.C

raw
1 // PR c++/89214
2 // { dg-do compile { target c++17 } }
3
4 struct B {
5 int c;
6 };
7
8 struct D : B { };
9
10 void
11 foo ()
12 {
13 D d1 = {42};
14 D d2 = {{42}};
15
16 D d4 = D{42};
17 D d5 = D{{42}};
18
19 D d7 = {D{42}};
20 D d8 = {D{{42}}};
21
22 D d10 = {{D{42}}}; // { dg-warning "initializing a base class of type .B. results in object slicing" }
23 D d11 = {{D{{42}}}}; // { dg-warning "initializing a base class of type .B. results in object slicing" }
24
25 D dd1{42};
26 D dd2{{42}};
27
28 D dd7{D{42}};
29 D dd8{D{{42}}};
30
31 D dd10{{D{42}}}; // { dg-warning "initializing a base class of type .B. results in object slicing" }
32 D dd11{{D{{42}}}}; // { dg-warning "initializing a base class of type .B. results in object slicing" }
33 }