Fortran: Fix PR 47485.
[gcc.git] / gcc / testsuite / g++.dg / warn / Wuninitialized-31.C
blobe22b150db467a5cb1f7fb5b6ce86b551f9eeb810
1 // PR c++/19808
2 // { dg-do compile }
3 // { dg-options "-Wuninitialized" }
5 class AllocatorWithCleanup {
6 public:
7   int *allocate(int);
8 };
9 class SecBlock {
10   SecBlock() : m_ptr(m_alloc.allocate(0)) {} // { dg-bogus "uninitialized" }
11   AllocatorWithCleanup m_alloc;
12   int *m_ptr;
15 struct A {
16   int *allocate(int);
19 struct B {
20   int : 0;
21   int *allocate(int);
24 struct C : B {
27 struct D {
28   char arr[0];
29   int *allocate(int);
32 struct E { };
34 struct F {
35   E arr[10];
36   int *allocate(int);
39 struct G {
40   E e;
41   int *allocate(int);
44 struct H {
45   virtual void foo ();
46   int *allocate(int);
49 template<typename T>
50 struct X {
51   X() : m_ptr(t.allocate(0)) {} // { dg-bogus "uninitialized" }
52   T t;
53   int *m_ptr;
56 struct V {
57   int a;
58   int *allocate(int);
61 struct Z {
62   Z() : m_ptr(v.allocate(0)) {} // { dg-warning "uninitialized" }
63   V v;
64   int *m_ptr;
67 X<A> x1;
68 X<B> x2;
69 X<C> x3;
70 X<D> x4;
71 X<F> x5;
72 X<G> x6;
73 X<H> x7;