| 1 |
// { dg-do run } |
| 2 |
// GROUPS passed operators |
| 3 |
// opr-new file |
| 4 |
// From: David Binderman 3841 <[email protected]> |
| 5 |
// Date: Mon, 21 Jun 93 11:42:11 +0200 |
| 6 |
// Subject: G++ 2.4.3 and operator new |
| 7 |
// Message-ID: <[email protected]> |
| 8 |
|
| 9 |
int FLAG=0; |
| 10 |
|
| 11 |
#include <new> |
| 12 |
|
| 13 |
extern "C" int printf( const char *, ...); |
| 14 |
|
| 15 |
void * 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: |
| 21 |
K( int j) { |
| 22 |
i = j; |
| 23 |
} |
| 24 |
}; |
| 25 |
|
| 26 |
int 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 |
} |