63 lines · plain
1// RUN: %clang_cc1 -fsyntax-only -std=c++11 -Wno-objc-root-class -Wno-incomplete-implementation -triple x86_64-apple-macosx10.10.0 -verify %s2 3struct S {4 int 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@end9 10@interface Bar: class // expected-error {{expected identifier; 'class' is a keyword in Objective-C++}}11@end12 13@protocol P // ok14@end15 16@protocol new // expected-error {{expected identifier; 'new' is a keyword in Objective-C++}}17@end18 19@protocol P2;20@protocol delete // expected-error {{expected identifier; 'delete' is a keyword in Objective-C++}}21@end22 23@class Foo, try; // expected-error {{expected identifier; 'try' is a keyword in Objective-C++}}24 25@interface Foo26 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@end33 34@interface Foo () <P, new> // expected-error {{expected identifier; 'new' is a keyword in Objective-C++}}35@end36 37@implementation Foo38 39@synthesize a = _a; // ok40@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@end48 49@implementation class // expected-error {{expected identifier; 'class' is a keyword in Objective-C++}}50@end51 52@implementation Bar: class // expected-error {{expected identifier; 'class' is a keyword in Objective-C++}}53@end54 55@compatibility_alias C Foo; // ok56@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); // ok61 (void)@protocol(delete); // expected-error {{expected identifier; 'delete' is a keyword in Objective-C++}}62}63