summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/function-extern-c.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2013-02-14 01:18:37 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2013-02-14 01:18:37 +0000
commitf4187658fa824f8f24ef578377ff6c174f527021 (patch)
tree63b136d6bc5c88ec27f10ddc87734bd591873d36 /clang/test/SemaCXX/function-extern-c.cpp
parentb7444cd11ef1f688d91f0970f2615177af63916f (diff)
downloadbcm5719-llvm-f4187658fa824f8f24ef578377ff6c174f527021.tar.gz
bcm5719-llvm-f4187658fa824f8f24ef578377ff6c174f527021.zip
Add a getLanguageLinkage method to VarDecls and FunctionDecls. Use it to fix
some cases where functions with no language linkage were being treated as having C language linkage. In particular, don't warn in extern "C" { static NonPod foo(); } Since getLanguageLinkage checks the language linkage, the linkage computation cannot use the language linkage. Break the loop by checking just the context in the linkage computation. llvm-svn: 175117
Diffstat (limited to 'clang/test/SemaCXX/function-extern-c.cpp')
-rw-r--r--clang/test/SemaCXX/function-extern-c.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/function-extern-c.cpp b/clang/test/SemaCXX/function-extern-c.cpp
index 2a073c79fc4..a4b8400abcf 100644
--- a/clang/test/SemaCXX/function-extern-c.cpp
+++ b/clang/test/SemaCXX/function-extern-c.cpp
@@ -51,3 +51,13 @@ namespace test2 {
};
A f(void); // expected-warning {{'f' has C-linkage specified, but returns user-defined type 'test2::A' which is incompatible with C}}
}
+
+namespace test3 {
+ struct A {
+ A(const A&);
+ };
+ extern "C" {
+ // Don't warn for static functions.
+ static A f(void);
+ }
+}
OpenPOWER on IntegriCloud