aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/warn/Wzero-as-null-pointer-constant-2.C
blob: 317d852c95d8673da8ccd3410ad599c4ef990b46 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// PR c++/51045
// { dg-options "-Wzero-as-null-pointer-constant" }

template <typename T>
struct A
{
  A() { t = new T; }

  ~A()
  {
    delete t;
  }
  T* t;
};

template <typename T>
struct B
{
  B() { t = new T[1]; }

  ~B()
  {
    delete [] t;
  }
  T* t;
};

template <typename Type>
class Variant
{
  Type t;
};

class Op;

typedef Variant<A<Op> > vara;
typedef Variant<B<Op> > varb;

class Op
{
  vara x;
  varb y;
};

int main()
{
  vara a;
  varb b;
}