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