[Top][All Lists]

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

Re: Can't mix native exceptions and ObjC++

From: Andrew Pinski
Subject: Re: Can't mix native exceptions and ObjC++
Date: Sat, 13 Mar 2010 06:17:36 -0800

Sent from my iPhone

On Mar 13, 2010, at 5:17 AM, David Chisnall <address@hidden> wrote:

On 13 Mar 2010, at 10:12, Isamu Mogi wrote:


This is a bug in GCC.

obj-c++.dg/try-catch-[29].mm (objc exceptions are broken) fails with the GNU

This is a compiler bug, not a runtime bug. Objective-C++ is unmaintained in GCC and is known to be broken. It is not shipped by default on a number of platforms for this reason. If you use it and stuff breaks, don't expect any sympathy. You should be surprised if it works at all for any code, not that it breaks for some.

I think when says with the gnu runtime, he means when compiling for that runtime. That is what I had meant in the bug report too. :).

I can confirm that this test case works correctly with clang. I don't believe that you can catch both ObjC and C++ exceptions in the same stack frame yet, but catching just one works correctly (it's a bit tricky catching both; you'd need another personality function that can handle the unwinding stuff).

Quick and dirty fix here:

#define NS_HANDLER } @catch (id) { \ NSException* localException = \ [NSException exceptionWithName:@"Unknown" \ reason:@"Unknown" \ userInfo:nil]; \

This 'fix' prevents you from catching any Objective-C exceptions in ObjC++ code. It's better to describe it as 'a different kind of complete breakage' than a 'fix.'


-- Sent from my PDP-11

Discuss-gnustep mailing list

reply via email to

[Prev in Thread] Current Thread [Next in Thread]