• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// RUN: %clang_cc1 -fsyntax-only -fobjc-arc -fblocks -Wno-objc-root-class -verify %s
2
3// rdar://problem/10982793
4// [p foo] in ARC creates a cleanup.
5// The plus is invalid and causes the cleanup to go unbound.
6// Don't crash.
7@interface A
8- (id) foo;
9@end
10void takeBlock(void (^)(void));
11void test0(id p) {
12  takeBlock(^{ [p foo] + p; }); // expected-error {{invalid operands to binary expression}}
13}
14
15void test1(void) {
16  __autoreleasing id p; // expected-note {{'p' declared here}}
17  takeBlock(^{ (void) p; }); // expected-error {{cannot capture __autoreleasing variable in a block}}
18}
19
20// rdar://17024681
21@class WebFrame;
22@interface WebView  // expected-note {{previous definition is here}}
23- (WebFrame *)mainFrame;
24@end
25
26@interface WebView  // expected-error {{duplicate interface definition for class 'WebView'}}
27@property (nonatomic, readonly, strong) WebFrame *mainFrame;
28@end
29
30@interface UIWebDocumentView
31- (WebView *)webView;
32@end
33
34@interface UIWebBrowserView : UIWebDocumentView
35@end
36
37@interface StoreBanner @end
38
39@implementation StoreBanner
40+ (void)readMetaTagContentForUIWebBrowserView:(UIWebBrowserView *)browserView
41{
42  [[browserView webView] mainFrame];
43}
44@end
45