summaryrefslogtreecommitdiffstats
path: root/test
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
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')
-rw-r--r--test/SemaObjC/alias-test-2.m4
-rw-r--r--test/SemaObjCXX/objc-extern-c.mm30
2 files changed, 32 insertions, 2 deletions
diff --git a/test/SemaObjC/alias-test-2.m b/test/SemaObjC/alias-test-2.m
index 1f12b76055..0c186885a3 100644
--- a/test/SemaObjC/alias-test-2.m
+++ b/test/SemaObjC/alias-test-2.m
@@ -9,9 +9,9 @@
@compatibility_alias AliasForSuper Super;
-@interface MyAlias : AliasForSuper // expected-error {{duplicate interface definition for class 'MyWpModule'}}
+@implementation MyAlias : AliasForSuper // expected-error {{conflicting super class name 'Super'}}
@end
-@implementation MyAlias : AliasForSuper // expected-error {{conflicting super class name 'Super'}}
+@interface MyAlias : AliasForSuper // expected-error {{duplicate interface definition for class 'MyWpModule'}}
@end
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}}
+}