This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/15057] Compiling of conditional value throw constructs cause a segmentation violation


------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]