Debian Codegraph @

gcc/testsuite/g++.dg/warn/Wuninitialized-17.C

raw
1 // PR c++/19808
2 // { dg-do compile { target c++11 } }
3 // { dg-options "-Wuninitialized -Winit-self" }
4
5 int
6 foo (int *p)
7 {
8 *p = 42;
9 return 5;
10 }
11
12 struct S {
13 int x;
14 int y;
15 int z;
16 S() : x(foo (&y)), z(y) { } // { dg-bogus "uninitialized" }
17 };
18
19 struct T {
20 int x;
21 int y;
22 int z;
23 T() : x(({ y = 30; 42; })), z(y) { } // { dg-bogus "uninitialized" }
24 };
25
26 struct A {
27 int x, y, z;
28 int f () { y = 1; return 2; }
29 A ():
30 x (f ()),
31 z (y) // { dg-bogus "uninitialized" }
32 { }
33 };