+// TEST_CFLAGS -framework Foundation
+
#include "test.h"
#include <objc/objc-exception.h>
#include <Foundation/Foundation.h>
static id exc;
+static void handler(id unused, void *ctx) __attribute__((used));
static void handler(id unused __unused, void *ctx __unused)
{
testassert(state == 3); state++;
+(BOOL) resolveClassMethod:(SEL)__unused name
{
testassert(state == 1); state++;
+#if !TARGET_OS_EMBEDDED && !TARGET_OS_IPHONE && !TARGET_IPHONE_SIMULATOR
objc_addExceptionHandler(&handler, 0);
- testassert(state == 2); state++;
+ testassert(state == 2);
+#else
+ state++; // handler would have done this
+#endif
+ state++;
exc = [Foo new];
@throw exc;
}
int main()
{
+#if TARGET_IPHONE_SIMULATOR
+ testwarn("<rdar://problem/7965763> Simulator: cannot throw exceptions across objc_msgSend");
+ succeed(__FILE__);
+#else
int i;
// unwind exception and alt handler through objc_msgSend()
[pool drain];
succeed(__FILE__);
+#endif
}
#endif