Fortran: Fix PR 47485.
[gcc.git] / gcc / testsuite / g++.dg / warn / Wuninitialized-19.C
blobe4d53d4bfbaea75bada7989d0a8c04aa49f6d2ad
1 // PR c++/19808
2 // { dg-do compile { target c++11 } }
3 // { dg-options "-Wuninitialized" }
4 // Test we warn when initializing a base class.
6 struct A {
7   A(int) { }
8 };
10 struct B : public A {
11   int x;
12   B() : A(x) { } // { dg-warning "member .B::x. is used uninitialized" }
15 struct C : public A {
16   int x;
17   int y;
18   C() : A(y = 4), x(y) { }
21 struct D : public A {
22   int x;
23   D() : A{x} { } // { dg-warning "member .D::x. is used uninitialized" }
26 struct E : public A {
27   int x;
28   int y;
29   E() : A{y = 4}, x(y) { }
32 struct F {
33   F(int&) { }
36 struct G : F {
37   int x;
38   G() : F(x) { }
41 struct H {
42   H(int *) { }
45 struct I : H {
46   int x;
47   int arr[2];
48   I() : H(&x) { }
49   I(int) : H(arr) { }