summaryrefslogtreecommitdiffstats
path: root/test/SemaObjCXX
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-11-13 22:08:30 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-11-13 22:08:30 +0000
commit4fc04da71ed46d63dc991dbea4fd52341e56c0a1 (patch)
treee34a67e05427c746e8509144885fce5f44354a19 /test/SemaObjCXX
parente2d4f4ed44a32f179c6d48cd1dba8346ab2129d9 (diff)
Don't crash when a duplicate interface/protocol is inside an extern "C" context.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144508 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaObjCXX')
-rw-r--r--test/SemaObjCXX/objc-extern-c.mm30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/SemaObjCXX/objc-extern-c.mm b/test/SemaObjCXX/objc-extern-c.mm
new file mode 100644
index 0000000000..6bd37610ae
--- /dev/null
+++ b/test/SemaObjCXX/objc-extern-c.mm
@@ -0,0 +1,30 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+@protocol P // expected-note {{previous}}
+-(void)meth1;
+@end
+
+@interface I // expected-note {{previous}}
+@end
+
+@interface I2
+@end
+@interface I2(C) // expected-note {{previous}}
+@end
+
+extern "C" {
+@protocol P // expected-warning {{duplicate protocol definition of 'P' is ignored}}
+-(void)meth2;
+@end
+
+@interface I // expected-error {{duplicate}}
+@end
+
+@interface I2(C) // expected-warning {{duplicate}}
+@end
+}
+
+void test(id<P> p) {
+ [p meth1];
+ [p meth2]; // expected-warning {{not found}}
+}