1 // { dg-do run } 2 // GROUPS passed operators 3 // opr-new file 4 // From: (The Crossjammer) <xjam (at) cork.cs.berkeley.edu> 5 // Date: Mon, 23 Nov 92 23:35:26 PST 6 // Subject: g++-2.3.1 : Incorrectly calls overloaded operator new 7 // Message-ID: <9211240735.AA06872 (at) cork.CS.Berkeley.EDU> 8 9 10 #include <stdio.h> 11 #include <stdlib.h> 12 13 class blah { 14 int j; 15 public: 16 blah(); 17 void *operator new(size_t size) throw(); 18 }; 19 20 inline blah::blah() : j(0) { 21 22 } 23 24 25 void *blah::operator new(size_t size) throw(){ 26 printf ("FAIL\n"); 27 exit (1); 28 return NULL; 29 } 30 31 int main(int arg, char** argv) { 32 blah* blahPtr; 33 34 blahPtr = new blah[100]; 35 printf ("PASS\n"); 36 } 37