[Bug c++/15057] Compiling of conditional value throw constructs cause a segmentation violation
christian dot groove at gmx dot de
gcc-bugzilla@gcc.gnu.org
Fri Apr 23 22:45:00 GMT 2004
------- Additional Comments From christian dot groove at gmx dot de 2004-04-23 22:16 -------
(In reply to comment #4)
> How can we say if you don't provide us with a testcase?
>
> W.
Here we are:
#include <stdio.h>
#include <string.h>
char * null = (char *) 0 ;
// simple exception class
class errMessage
{
private: char messag[20] ;
private: int kind;
public: errMessage(char* msg, int knd)
{
strncpy(messag,msg,19) ;
kind = knd ;
};
};
// the error causing method
int simpleDepp(char* m1)
{
puts ("having some troubles") ;
if (m1 == (void *) 0)
{
throw errMessage("forget me", 23) ;
}
else
{
throw (null == m1) ?
errMessage("panic", 23) :
errMessage(m1, 23) ;
}
}
int main (int argc, char** argv)
{
try
{
const int egal = simpleDepp(null) ;
}
catch(errMessage er)
{
puts("caught something") ;
}
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15057
More information about the Gcc-bugs
mailing list