summaryrefslogtreecommitdiff
path: root/test/SemaObjCXX
diff options
context:
space:
mode:
authorAlex Lorenz <arphaman@gmail.com>2016-12-07 10:24:44 +0000
committerAlex Lorenz <arphaman@gmail.com>2016-12-07 10:24:44 +0000
commitadfb69666c622cf20c39d9fa4de3ec78170ba6e5 (patch)
tree8b032043e5bc36e28769c513ce61ed32db5910a2 /test/SemaObjCXX
parent2e70037cfe544654fd596c4d1b79260766d4be7f (diff)
[ObjC++] Don't enter a C++ declarator scope when the current context is
an Objective-C declaration This commit ensures that Sema won't enter a C++ declarator scope when the current context is an Objective-C declaration. This prevents an assertion failure in EnterDeclaratorContext that's used to ensure that current context will be restored correctly after exiting the declarator context. rdar://20560175 Differential Revision: https://reviews.llvm.org/D26922 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@288893 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaObjCXX')
-rw-r--r--test/SemaObjCXX/crash.mm35
1 files changed, 35 insertions, 0 deletions
diff --git a/test/SemaObjCXX/crash.mm b/test/SemaObjCXX/crash.mm
index 19cf309982..a9754b7bc5 100644
--- a/test/SemaObjCXX/crash.mm
+++ b/test/SemaObjCXX/crash.mm
@@ -25,3 +25,38 @@ template<typename...Ts> void f(Ts); // expected-error {{unexpanded}}
// expected-warning@-2 {{variadic templates are a C++11 extension}}
#endif
@end
+
+// rdar://20560175
+
+struct OuterType {
+ typedef int InnerType;
+};
+
+namespace ns {
+ typedef int InnerType;
+};
+
+@protocol InvalidProperties
+
+@property (nonatomic) (OuterType::InnerType) invalidTypeParens;
+// expected-error@-1 {{type name requires a specifier or qualifier}}
+// expected-error@-2 {{property requires fields to be named}}
+// expected-error@-3 {{expected ';' at end of declaration list}}
+// expected-error@-4 {{C++ requires a type specifier for all declarations}}
+// expected-error@-5 {{cannot declare variable inside @interface or @protocol}}
+
+@property (nonatomic) (ns::InnerType) invalidTypeParens2;
+// expected-error@-1 {{type name requires a specifier or qualifier}}
+// expected-error@-2 {{property requires fields to be named}}
+// expected-error@-3 {{expected ';' at end of declaration list}}
+// expected-error@-4 {{C++ requires a type specifier for all declarations}}
+// expected-error@-5 {{cannot declare variable inside @interface or @protocol}}
+
+@property (nonatomic) int OuterType::InnerType; // expected-error {{property requires fields to be named}}
+
+@property (nonatomic) int OuterType::InnerType foo; // expected-error {{property requires fields to be named}}
+// expected-error@-1 {{expected ';' at end of declaration list}}
+// expected-error@-2 {{C++ requires a type specifier for all declarations}}
+// expected-error@-3 {{cannot declare variable inside @interface or @protocol}}
+
+@end