| Douglas Gregor | 205b068 | 2012-04-30 18:13:01 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only %s -verify |
| Charles Li | 542f04c | 2015-11-11 19:34:47 +0000 | [diff] [blame] | 2 | // RUN: %clang_cc1 -fsyntax-only -std=c++98 %s -verify |
| 3 | // RUN: %clang_cc1 -fsyntax-only -std=c++11 %s -verify |
| Douglas Gregor | 205b068 | 2012-04-30 18:13:01 +0000 | [diff] [blame] | 4 | |
| 5 | // <rdar://problem/11286701> |
| 6 | namespace std { |
| 7 | template<typename T, typename U> class pair; |
| 8 | } |
| 9 | |
| 10 | @interface NSObject |
| 11 | @end |
| 12 | |
| 13 | @interface Test : NSObject |
| 14 | @end |
| 15 | |
| 16 | @implementation Test |
| 17 | |
| 18 | struct EvilStruct { |
| Richard Smith | 698875a | 2013-11-20 23:40:57 +0000 | [diff] [blame] | 19 | } // expected-error {{expected ';' after struct}} |
| Douglas Gregor | 205b068 | 2012-04-30 18:13:01 +0000 | [diff] [blame] | 20 | |
| Richard Smith | 698875a | 2013-11-20 23:40:57 +0000 | [diff] [blame] | 21 | typedef std::pair<int, int> IntegerPair; |
| 22 | |
| Charles Li | 542f04c | 2015-11-11 19:34:47 +0000 | [diff] [blame] | 23 | template<typename...Ts> void f(Ts); // expected-error {{unexpanded}} |
| 24 | #if __cplusplus <= 199711L // C++03 or earlier modes |
| 25 | // expected-warning@-2 {{variadic templates are a C++11 extension}} |
| 26 | #endif |
| Douglas Gregor | 205b068 | 2012-04-30 18:13:01 +0000 | [diff] [blame] | 27 | @end |
| Alex Lorenz | e151f010 | 2016-12-07 10:24:44 +0000 | [diff] [blame] | 28 | |
| 29 | // rdar://20560175 |
| 30 | |
| 31 | struct OuterType { |
| 32 | typedef int InnerType; |
| 33 | }; |
| 34 | |
| 35 | namespace ns { |
| 36 | typedef int InnerType; |
| 37 | }; |
| 38 | |
| 39 | @protocol InvalidProperties |
| 40 | |
| 41 | @property (nonatomic) (OuterType::InnerType) invalidTypeParens; |
| 42 | // expected-error@-1 {{type name requires a specifier or qualifier}} |
| 43 | // expected-error@-2 {{property requires fields to be named}} |
| 44 | // expected-error@-3 {{expected ';' at end of declaration list}} |
| 45 | // expected-error@-4 {{C++ requires a type specifier for all declarations}} |
| 46 | // expected-error@-5 {{cannot declare variable inside @interface or @protocol}} |
| 47 | |
| 48 | @property (nonatomic) (ns::InnerType) invalidTypeParens2; |
| 49 | // expected-error@-1 {{type name requires a specifier or qualifier}} |
| 50 | // expected-error@-2 {{property requires fields to be named}} |
| 51 | // expected-error@-3 {{expected ';' at end of declaration list}} |
| 52 | // expected-error@-4 {{C++ requires a type specifier for all declarations}} |
| 53 | // expected-error@-5 {{cannot declare variable inside @interface or @protocol}} |
| 54 | |
| 55 | @property (nonatomic) int OuterType::InnerType; // expected-error {{property requires fields to be named}} |
| 56 | |
| 57 | @property (nonatomic) int OuterType::InnerType foo; // expected-error {{property requires fields to be named}} |
| 58 | // expected-error@-1 {{expected ';' at end of declaration list}} |
| 59 | // expected-error@-2 {{C++ requires a type specifier for all declarations}} |
| 60 | // expected-error@-3 {{cannot declare variable inside @interface or @protocol}} |
| 61 | |
| 62 | @end |