• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// RUN: %clang_cc1 -fsyntax-only -verify -fobjc-exceptions -Wno-objc-root-class %s
2
3// rdar://6124613
4void test1() {
5  void *xyzzy = 0;
6  void *p = @xyzzy; // expected-error {{unexpected '@' in program}}
7}
8
9// <rdar://problem/7495713>
10// This previously triggered a crash because the class has not been defined.
11@implementation RDar7495713 (rdar_7495713_cat)  // expected-error{{cannot find interface declaration for 'RDar7495713'}}
12- (id) rdar_7495713 {
13  __PRETTY_FUNCTION__; // expected-warning{{expression result unused}}
14}
15@end
16
17// <rdar://problem/7881045>
18// This previously triggered a crash because a ';' was expected after the @throw statement.
19void foo() {
20  @throw (id)0 // expected-error{{expected ';' after @throw}}
21}
22
23// <rdar://problem/10415026>
24@class NSView;
25@implementation IBFillView(IBFillViewIntegration) // expected-error {{cannot find interface declaration for 'IBFillView'}}
26- (NSView *)ibDesignableContentView {
27    [Cake lie]; // expected-error {{undeclared}}
28    return self;
29}
30@end
31
32@interface I
33@end
34@interface I2
35@end
36
37@implementation I // expected-note {{started here}}
38-(void) foo {}
39
40@implementation I2 // expected-error {{missing '@end'}}
41-(void) foo2 {}
42@end
43
44@end // expected-error {{'@end' must appear in an Objective-C context}}
45
46@class ForwardBase;
47@implementation SomeI : ForwardBase // expected-error {{cannot find interface declaration for 'ForwardBase', superclass of 'SomeI'}} \
48                                    // expected-warning {{cannot find interface declaration for 'SomeI'}}
49-(void)meth {}
50@end
51
52@interface I3
53__attribute__((unavailable)) @interface I4 @end // expected-error {{Objective-C declarations may only appear in global scope}}
54@end
55