This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/15057] Compiling of conditional value throw constructs cause a segmentation violation
- From: "christian dot groove at gmx dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 23 Apr 2004 22:16:05 -0000
- Subject: [Bug c++/15057] Compiling of conditional value throw constructs cause a segmentation violation
- References: <20040421204752.15057.christian.groove@gmx.de>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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