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 13 extern "C" int printf( const char *, ...); 14 new(std::size_t,const std::nothrow_t &)15void * operator new(std::size_t, const std::nothrow_t&) throw() { FLAG=1; return 0; } 16 17 class K { 18 private: 19 int i; 20 public: K(int j)21 K( int j) { 22 i = j; 23 } 24 }; 25 main(void)26int main(void) 27 { 28 K * pK = new (std::nothrow) K( 10); 29 if ( FLAG != 1 ) 30 { printf ("FAIL\n"); return 1; } 31 else 32 printf ("PASS\n"); 33 return 0; 34 } 35