summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.other/delete5.C
blob: c447b73e537bb6400c3c12313a2c77209123cb5a (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
// { dg-do assemble  }
// Copyright (C) 1999 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 15 Apr 1999 <nathan@acm.org>

typedef __SIZE_TYPE__ size_t;

struct X
{
  int i;
  
  X():i(){}
  void *operator new(size_t)
  {
    return 0; // { dg-warning "" } cannot return NULL
  }
  void *operator new[](size_t)
  {
    return 0; // { dg-warning "" } cannot return NULL
  }
};

struct Y
{
  int i;
  
  Y():i(){}
  void *operator new(size_t) throw()
  {
    return 0; // ok
  }
  void *operator new[](size_t) throw()
  {
    return 0; // ok
  }
};

int main()
{
  Y *yp = new Y;
  
  return yp != 0;
}