summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2012-12-30 20:40:41 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2012-12-30 20:40:41 +0000
commita5c892058c01aa39c7956b12679ec744cd0a96ac (patch)
tree4c6b8ffa6df7988fba8cff130afceee96c7241ad /clang/test
parent10af67a9c3a5b1069b9403a0b3cf8ed94b983a09 (diff)
downloadbcm5719-llvm-a5c892058c01aa39c7956b12679ec744cd0a96ac.tar.gz
bcm5719-llvm-a5c892058c01aa39c7956b12679ec744cd0a96ac.zip
Use hasCLanguageLinkage when warning about non C return types.
llvm-svn: 171263
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/SemaCXX/function-extern-c.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/function-extern-c.cpp b/clang/test/SemaCXX/function-extern-c.cpp
index 16dbbb26fc6..2a073c79fc4 100644
--- a/clang/test/SemaCXX/function-extern-c.cpp
+++ b/clang/test/SemaCXX/function-extern-c.cpp
@@ -38,3 +38,16 @@ extern "C" long long f11( void );
extern "C" A *f10( void );
extern "C" struct mypodstruct f12(); // expected-warning {{'f12' has C-linkage specified, but returns incomplete type 'struct mypodstruct' which could be incompatible with C}}
+
+namespace test2 {
+ // FIXME: we should probably suppress the first warning as the second one
+ // is more precise.
+ // For now this tests that a second 'extern "C"' is not necessary to trigger
+ // the warning.
+ struct A;
+ extern "C" A f(void); // expected-warning {{'f' has C-linkage specified, but returns incomplete type 'test2::A' which could be incompatible with C}}
+ 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}}
+}
OpenPOWER on IntegriCloud