llvm-project
62 строки · 2.3 Кб
1// RUN: %clang_cc1 -fsyntax-only -std=c++11 -Wno-objc-root-class -Wno-incomplete-implementation -triple x86_64-apple-macosx10.10.0 -verify %s
2
3struct S {
4int throw; // expected-error {{expected member name or ';' after declaration specifiers; 'throw' is a keyword in Objective-C++}}
5};
6
7@interface class // expected-error {{expected identifier; 'class' is a keyword in Objective-C++}}
8@end
9
10@interface Bar: class // expected-error {{expected identifier; 'class' is a keyword in Objective-C++}}
11@end
12
13@protocol P // ok
14@end
15
16@protocol new // expected-error {{expected identifier; 'new' is a keyword in Objective-C++}}
17@end
18
19@protocol P2;
20@protocol delete // expected-error {{expected identifier; 'delete' is a keyword in Objective-C++}}
21@end
22
23@class Foo, try; // expected-error {{expected identifier; 'try' is a keyword in Objective-C++}}
24
25@interface Foo
26
27@property (readwrite, nonatomic) int a, b, throw; // expected-error {{expected member name or ';' after declaration specifiers; 'throw' is a keyword in Objective-C++}}
28
29-foo:(int)class; // expected-error {{expected identifier; 'class' is a keyword in Objective-C++}}
30+foo:(int)constexpr; // expected-error {{expected identifier; 'constexpr' is a keyword in Objective-C++}}
31
32@end
33
34@interface Foo () <P, new> // expected-error {{expected identifier; 'new' is a keyword in Objective-C++}}
35@end
36
37@implementation Foo
38
39@synthesize a = _a; // ok
40@synthesize b = virtual; // expected-error {{expected identifier; 'virtual' is a keyword in Objective-C++}}
41
42@dynamic throw; // expected-error {{expected identifier; 'throw' is a keyword in Objective-C++}}
43
44-foo:(int)class { // expected-error {{expected identifier; 'class' is a keyword in Objective-C++}}
45}
46
47@end
48
49@implementation class // expected-error {{expected identifier; 'class' is a keyword in Objective-C++}}
50@end
51
52@implementation Bar: class // expected-error {{expected identifier; 'class' is a keyword in Objective-C++}}
53@end
54
55@compatibility_alias C Foo; // ok
56@compatibility_alias const_cast Bar; // expected-error {{expected identifier; 'const_cast' is a keyword in Objective-C++}}
57@compatibility_alias C2 class; // expected-error {{expected identifier; 'class' is a keyword in Objective-C++}}
58
59void func() {
60(void)@protocol(P); // ok
61(void)@protocol(delete); // expected-error {{expected identifier; 'delete' is a keyword in Objective-C++}}
62}
63