33 lines · plain
1// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s2 3namespace C {4 5@protocol P; //expected-error{{Objective-C declarations may only appear in global scope}}6 7@class Bar; //expected-error{{Objective-C declarations may only appear in global scope}}8 9@compatibility_alias Foo Bar; //expected-error{{Objective-C declarations may only appear in global scope}}10 11@interface A //expected-error{{Objective-C declarations may only appear in global scope}}12@end13 14@implementation A //expected-error{{Objective-C declarations may only appear in global scope}}15@end16 17@protocol P //expected-error{{Objective-C declarations may only appear in global scope}}18@end19 20@interface A(C) //expected-error{{Objective-C declarations may only appear in global scope}}21@end22 23@implementation A(C) //expected-error{{Objective-C declarations may only appear in global scope}}24@end25 26@interface B @end //expected-error{{Objective-C declarations may only appear in global scope}}27@implementation B //expected-error{{Objective-C declarations may only appear in global scope}}28+ (void) foo {}29@end30 31}32 33