1// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
2
3@interface StopAtAtEnd
4// This used to eat the @end
5int 123 // expected-error{{expected unqualified-id}}
6@end
7
8@implementation StopAtAtEnd // no-warning
9int 123 // expected-error{{expected unqualified-id}}
10@end
11
12
13@interface StopAtMethodDecls
14// This used to eat the method declarations
15int 123 // expected-error{{expected unqualified-id}}
16- (void)foo; // expected-note{{here}}
17int 456 // expected-error{{expected unqualified-id}}
18+ (void)bar; // expected-note{{here}}
19@end
20
21@implementation StopAtMethodDecls
22int 123 // expected-error{{expected unqualified-id}}
23- (id)foo {} // expected-warning{{conflicting return type}}
24int 456 // expected-error{{expected unqualified-id}}
25+ (id)bar {} // expected-warning{{conflicting return type}}
26@end
27
28
29@interface EmbeddedNamespace
30// This used to cause an infinite loop.
31namespace NS { // expected-error{{expected unqualified-id}}
32}
33- (id)test; // expected-note{{here}}
34@end
35
36@implementation EmbeddedNamespace
37int 123 // expected-error{{expected unqualified-id}}
38// We should still stop here and parse this namespace.
39namespace NS {
40  void foo();
41}
42
43// Make sure the declaration of -test was recognized.
44- (void)test { // expected-warning{{conflicting return type}}
45  // Make sure the declaration of NS::foo was recognized.
46  NS::foo();
47}
48
49@end
50
51
52@protocol ProtocolWithEmbeddedNamespace
53namespace NS { // expected-error{{expected unqualified-id}}
54
55}
56- (void)PWEN_foo; // expected-note{{here}}
57@end
58
59@interface ImplementPWEN <ProtocolWithEmbeddedNamespace>
60@end
61
62@implementation ImplementPWEN
63- (id)PWEN_foo {} // expected-warning{{conflicting return type}}
64@end
65