xref: /minix3/external/bsd/llvm/dist/clang/test/SemaObjC/autoreleasepool.m (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1f4a2713aSLionel Sambuc// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
2f4a2713aSLionel Sambuc
3f4a2713aSLionel Sambucvoid *objc_autoreleasepool_push();
4f4a2713aSLionel Sambucvoid autoreleasepool_pop(void*);
5f4a2713aSLionel Sambuc
6f4a2713aSLionel Sambuc@interface AUTORP @end
7f4a2713aSLionel Sambuc
8f4a2713aSLionel Sambuc@implementation AUTORP
9f4a2713aSLionel Sambuc- (void) unregisterTask:(id) task {
10*0a6a1f1dSLionel Sambuc  goto L;	// expected-error {{cannot jump}}
11f4a2713aSLionel Sambuc
12f4a2713aSLionel Sambuc  @autoreleasepool { // expected-note {{jump bypasses auto release push of @autoreleasepool block}}
13f4a2713aSLionel Sambuc        void *tmp = objc_autoreleasepool_push();
14f4a2713aSLionel Sambuc        L:
15f4a2713aSLionel Sambuc        autoreleasepool_pop(tmp);
16f4a2713aSLionel Sambuc        @autoreleasepool {
17f4a2713aSLionel Sambuc          return;
18f4a2713aSLionel Sambuc        }
19f4a2713aSLionel Sambuc  }
20f4a2713aSLionel Sambuc}
21f4a2713aSLionel Sambuc@end
22f4a2713aSLionel Sambuc
23