aboutsummaryrefslogtreecommitdiff
path: root/test/SemaCXX/function-extern-c.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/SemaCXX/function-extern-c.cpp')
-rw-r--r--test/SemaCXX/function-extern-c.cpp37
1 files changed, 36 insertions, 1 deletions
diff --git a/test/SemaCXX/function-extern-c.cpp b/test/SemaCXX/function-extern-c.cpp
index a4b8400abc..6ab9657350 100644
--- a/test/SemaCXX/function-extern-c.cpp
+++ b/test/SemaCXX/function-extern-c.cpp
@@ -49,7 +49,7 @@ namespace test2 {
struct A {
A(const A&);
};
- A f(void); // expected-warning {{'f' has C-linkage specified, but returns user-defined type 'test2::A' which is incompatible with C}}
+ A f(void); // no warning. warning is already issued on first declaration.
}
namespace test3 {
@@ -61,3 +61,38 @@ namespace test3 {
static A f(void);
}
}
+
+// rdar://13364028
+namespace rdar13364028 {
+class A {
+public:
+ virtual int x();
+};
+
+extern "C" {
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wreturn-type-c-linkage"
+A xyzzy();
+#pragma clang diagnostic pop
+A bbb(); // expected-warning {{'bbb' has C-linkage specified, but returns user-defined type 'rdar13364028::A' which is incompatible with C}}
+A ccc() { // expected-warning {{'ccc' has C-linkage specified, but returns user-defined type 'rdar13364028::A' which is incompatible with C}}
+ return A();
+};
+}
+
+A xyzzy();
+
+A xyzzy()
+{
+ return A();
+}
+
+A bbb()
+{
+ return A();
+}
+
+A bbb();
+
+A ccc();
+}