Debian Codegraph @

clang/test/SemaObjCXX/crash.mm

raw
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
5 namespace 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
17 struct EvilStruct {
18 } // expected-error {{expected ';' after struct}}
19
20 typedef std::pair<int, int> IntegerPair;
21
22 template<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
28 struct OuterType {
29 typedef int InnerType;
30 };
31
32 namespace 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;
64 id<Property0> x;
65 @protocol Property0;
66 id<Property0> y;
67 id<Property0> z = true ? x : y;