OSDN Git Service

PR c++/4872
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.old-deja / g++.law / operators27.C
1 // GROUPS passed operators
2 // opr-new file
3 // From: David Binderman 3841 <dcb@us-es.sel.de>
4 // Date:     Mon, 21 Jun 93 11:42:11 +0200
5 // Subject:  G++ 2.4.3 and operator new
6 // Message-ID: <9306210942.AA10276@slsvitt.us-es.sel.de>
7
8 int FLAG=0;
9
10 #include <new>
11
12 extern "C" int printf( const char *, ...);
13
14 void * operator new(size_t, const std::nothrow_t&) throw()         { FLAG=1; return 0; }
15
16 class K {
17 private:
18         int i;
19 public:
20         K( int j) {
21                 i = j;
22         }
23 };
24
25 int main(void)
26 {
27     K * pK = new (std::nothrow) K( 10);
28     if ( FLAG != 1 )
29         { printf ("FAIL\n"); return 1; }
30     else
31         printf ("PASS\n");
32     return 0;
33 }