1// RUN: %clang_cc1 -fsyntax-only %s -verify 2// RUN: %clang_cc1 -fsyntax-only -std=c++98 %s -verify 3// RUN: %clang_cc1 -fsyntax-only -std=c++11 %s -verify 4 5namespace std { 6 template<typename T, typename U> class pair; 7} 8 9@interface NSObject 10@end 11 12@interface Test : NSObject 13@end 14 15@implementation Test 16 17struct EvilStruct { 18} // expected-error {{expected ';' after struct}} 19 20 typedef std::pair<int, int> IntegerPair; 21 22template<typename...Ts> void f(Ts); // expected-error {{unexpanded}} 23#if __cplusplus <= 199711L // C++03 or earlier modes 24// expected-warning@-2 {{variadic templates are a C++11 extension}} 25#endif 26@end 27 28struct OuterType { 29 typedef int InnerType; 30}; 31 32namespace ns { 33 typedef int InnerType; 34}; 35 36@protocol InvalidProperties 37 38@property (nonatomic) (OuterType::InnerType) invalidTypeParens; 39// expected-error@-1 {{type name requires a specifier or qualifier}} 40// expected-error@-2 {{property requires fields to be named}} 41// expected-error@-3 {{expected ';' at end of declaration list}} 42// expected-error@-4 {{a type specifier is required for all declarations}} 43// expected-error@-5 {{cannot declare variable inside @interface or @protocol}} 44 45@property (nonatomic) (ns::InnerType) invalidTypeParens2; 46// expected-error@-1 {{type name requires a specifier or qualifier}} 47// expected-error@-2 {{property requires fields to be named}} 48// expected-error@-3 {{expected ';' at end of declaration list}} 49// expected-error@-4 {{a type specifier is required for all declarations}} 50// expected-error@-5 {{cannot declare variable inside @interface or @protocol}} 51 52@property (nonatomic) int OuterType::InnerType; // expected-error {{property requires fields to be named}} 53 54@property (nonatomic) int OuterType::InnerType foo; // expected-error {{property requires fields to be named}} 55// expected-error@-1 {{expected ';' at end of declaration list}} 56// expected-error@-2 {{a type specifier is required for all declarations}} 57// expected-error@-3 {{cannot declare variable inside @interface or @protocol}} 58 59@end 60 61// This used to crash. 62@protocol Property0; 63@protocol Property0; 64id<Property0> x; 65@protocol Property0; 66id<Property0> y; 67id<Property0> z = true ? x : y; 68