This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
'throw' in new operator
- To: egcs-bugs at cygnus dot com
- Subject: 'throw' in new operator
- From: Rafal Lukawski <rafal at dumb dot iinf dot polsl dot gliwice dot pl>
- Date: Sat, 13 Jun 1998 12:16:51 +0200 (CEST)
Hi,
the following program causes 'Aborted (core dumped)':
---- cut -----
#include <iostream.h>
#include <stdlib.h>
void *operator new(size_t size)
{
if(size>1000000)
throw(10);
return malloc(size);
}
int main()
{
try {
char *buf=new char[1024*1024];
}
catch(int)
{
cerr <<"no enough memory\n";
exit(-1);
}
}
---- cut --------
rafal[1]:~/work/test/cc$ g++ --version
egcs-2.91.40
rafal[1]:~/work/test/cc$ g++ d.cc -o d
rafal[1]:~/work/test/cc$ ./d
Aborted (core dumped)
--
Rafal Lukawski mailto:rafal@gliwice.pl, voice: (+48) 602 266 876
System Administrator - dumb.iinf.polsl.gliwice.pl