Issue error if variables are defined inside an objc class,
category or protocol.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67450 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/SemaObjC/interface-tu-variable.m b/test/SemaObjC/interface-tu-variable.m
new file mode 100644
index 0000000..f992996
--- /dev/null
+++ b/test/SemaObjC/interface-tu-variable.m
@@ -0,0 +1,21 @@
+// RUN: clang -fsyntax-only -verify %s
+
+@interface XX
+int x; // expected-error {{cannot declare variable inside a class, protocol or category}}
+int one=1; // expected-error {{cannot declare variable inside a class, protocol or category}}
+@end
+
+@protocol PPP
+int ddd; // expected-error {{cannot declare variable inside a class, protocol or category}}
+@end
+
+@interface XX(CAT)
+ char * III; // expected-error {{cannot declare variable inside a class, protocol or category}}
+ extern int OK;
+@end
+
+
+int main( int argc, const char *argv[] ) {
+ return x+one;
+}
+