mirror of
https://github.com/darlinghq/darling-libobjc2.git
synced 2024-11-26 21:50:25 +00:00
Check other exception handlers that should/shouldn't catch nil.
This commit is contained in:
parent
b2e7c50704
commit
e121b34a9f
@ -1,5 +1,23 @@
|
||||
#include "Test.h"
|
||||
|
||||
|
||||
#ifdef __has_attribute
|
||||
#if __has_attribute(objc_root_class)
|
||||
__attribute__((objc_root_class))
|
||||
#endif
|
||||
#endif
|
||||
@interface NSObject
|
||||
{
|
||||
Class isa;
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation NSObject
|
||||
+ (id)new
|
||||
{
|
||||
return class_createInstance(self, 0);
|
||||
}
|
||||
@end
|
||||
int main(void)
|
||||
{
|
||||
BOOL caught_exception = NO;
|
||||
@ -7,11 +25,25 @@ int main(void)
|
||||
{
|
||||
@throw(nil);
|
||||
}
|
||||
@catch (NSObject* o)
|
||||
{
|
||||
assert(0);
|
||||
}
|
||||
@catch (id x)
|
||||
{
|
||||
assert(nil == x);
|
||||
caught_exception = YES;
|
||||
}
|
||||
assert(caught_exception == YES);
|
||||
caught_exception = NO;
|
||||
@try
|
||||
{
|
||||
@throw(nil);
|
||||
}
|
||||
@catch (...)
|
||||
{
|
||||
caught_exception = YES;
|
||||
}
|
||||
assert(caught_exception == YES);
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user