Fortran: Fix PR 47485.
[gcc.git] / gcc / testsuite / g++.dg / warn / Wuninitialized-28.C
blob816249c2b9c85535814401cdc1cd529640f1c100
1 // PR c++/19808
2 // { dg-do compile { target c++11 } }
3 // { dg-options "-Wuninitialized" }
5 struct S {
6   int i, j, k, l;
7   S() : i(j), // { dg-warning "member .S::j. is used uninitialized" }
8         j(1),
9         k(l + 1), // { dg-warning "member .S::l. is used uninitialized" }
10         l(2) { }
13 struct A {
14   int a, b, c;
15   A() : a(b // { dg-warning "member .A::b. is used uninitialized" }
16           + c) { } // { dg-warning "member .A::c. is used uninitialized" }
19 struct B {
20   int &r;
21   int *p;
22   int a;
23   B() : r(a), p(&a), a(1) { }
26 struct C {
27   const int &r1, &r2;
28   C () : r1(r2), // { dg-warning "reference .C::r2. is not yet bound to a value when used here" }
29          r2(r1) { }
32 struct D {
33   int a = 1;
34   int b = 2;
35   D() : a(b + 1), b(a + 1) { } // { dg-warning "member .D::b. is used uninitialized" }
38 struct E {
39   int a = 1;
40   E() : a(a + 1) { } // { dg-warning "member .E::a. is used uninitialized" }
43 struct F {
44   int a = 1;
45   int b;
46   F() : b(a + 1) { }
49 struct bar {
50   int a;
51   bar() {}
52   bar(bar&) {}
55 class foo {
56   bar first;
57   bar second;
58 public:
59   foo() : first(second) {} // { dg-warning "member .foo::second. is used uninitialized" }