1 // PR c++/19808 2 // { dg-do compile { target c++11 } } 3 // { dg-options "-Wuninitialized" } 4 5 struct S { 6 int i, j, k, l; SS7 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) { } 11 }; 12 13 struct A { 14 int a, b, c; AA15 A() : a(b // { dg-warning "member .A::b. is used uninitialized" } 16 + c) { } // { dg-warning "member .A::c. is used uninitialized" } 17 }; 18 19 struct B { 20 int &r; 21 int *p; 22 int a; BB23 B() : r(a), p(&a), a(1) { } 24 }; 25 26 struct C { 27 const int &r1, &r2; CC28 C () : r1(r2), // { dg-warning "reference .C::r2. is not yet bound to a value when used here" } 29 r2(r1) { } 30 }; 31 32 struct D { 33 int a = 1; 34 int b = 2; DD35 D() : a(b + 1), b(a + 1) { } // { dg-warning "member .D::b. is used uninitialized" } 36 }; 37 38 struct E { 39 int a = 1; EE40 E() : a(a + 1) { } // { dg-warning "member .E::a. is used uninitialized" } 41 }; 42 43 struct F { 44 int a = 1; 45 int b; FF46 F() : b(a + 1) { } 47 }; 48 49 struct bar { 50 int a; barbar51 bar() {} barbar52 bar(bar&) {} 53 }; 54 55 class foo { 56 bar first; 57 bar second; 58 public: foo()59 foo() : first(second) {} // { dg-warning "member .foo::second. is used uninitialized" } 60 }; 61