Frank on Thu, 23 Sep 2004 13:07:34 -0500 (CDT)


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [ALACPP] compilation error


	Throwing a pair of parens at the end of the "throw MyException;" line seems to solve the problem.  I think the issue is that the parameter to the throw is actual data where MyException is a classname.  The int(1) (and the MyException()) bring a temporary variable into existence which is apparently valid.  I think...  But my books are still packed up from my move...

Frank Moody

On Thu, Sep 23, 2004 at 01:10:27AM -0700, Jon Stewart wrote:
> I have some code which expands in the preprocessor as such:
> 
> void testFunction(void) {
>   class MyException {
>     void *whatever;
>   };
> 
>   try {
>     throw MyException;
>     throw SomeOtherKnownGoodExceptionType("message");
>   }
>   catch(MyException e) {
>     ;
>   }
> }
> 
> This does not compile in gcc 3.4.2. I get:
> 	"error: expected primary-expression before ';' token"
> 
> 
> The cpp output sure looks okay to me! But note the hour...
> 
> If I change it to:
> 
> void testFunction(void) {
>   try {
>     throw int(1);
>     throw SomeOtherKnownGoodExceptionType("message");
>   }
>   catch(int i) {
>     ;
>   }
> }
> 
> then everything works just fine and dandy.
> 
> Am I screwing up the embedded class? Is gcc?
> 
> 
> 
> Jon
> -- 
> Jon Stewart                                 Advanced Los Angeles C++
> stew1@xxxxxxxxxxx                           http://www.alacpp.org
> _______________________________________________
> alacpp mailing list
> alacpp@xxxxxxxxxxx
> http://lists.ellipsis.cx/mailman/listinfo/alacpp
_______________________________________________
alacpp mailing list
alacpp@xxxxxxxxxxx
http://lists.ellipsis.cx/mailman/listinfo/alacpp