summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/attr-weak.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2013-01-16 23:11:15 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2013-01-16 23:11:15 +0000
commitf1d2f0ea21a5a66864da5cd8d39404df5b3fd652 (patch)
treefce2167eb760cedd2d50ac60a7b518cae65912ac /clang/test/SemaCXX/attr-weak.cpp
parent3302f2bd466930e094f0197e35835525dcfe7437 (diff)
downloadbcm5719-llvm-f1d2f0ea21a5a66864da5cd8d39404df5b3fd652.tar.gz
bcm5719-llvm-f1d2f0ea21a5a66864da5cd8d39404df5b3fd652.zip
Check for internal weak decls after merging.
This fixes pr14946. The problem was that the linkage computation was done too early, so things like "extern int a;" would be given external linkage, even if a previous declaration was static. llvm-svn: 172667
Diffstat (limited to 'clang/test/SemaCXX/attr-weak.cpp')
-rw-r--r--clang/test/SemaCXX/attr-weak.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/attr-weak.cpp b/clang/test/SemaCXX/attr-weak.cpp
index b6a9e0aa840..8939a28d75e 100644
--- a/clang/test/SemaCXX/attr-weak.cpp
+++ b/clang/test/SemaCXX/attr-weak.cpp
@@ -21,9 +21,16 @@ namespace {
};
}
+// GCC rejects the instantiation with the internal type, but some existing
+// code expects it. It is also not that different from giving hidden visibility
+// to parts of a template that have explicit default visibility, so we accept
+// this.
template <class T> struct Test7 {
void test7() __attribute__((weak)) {}
+ static int var __attribute__((weak));
};
+template <class T>
+int Test7<T>::var;
namespace { class Internal; }
template struct Test7<Internal>;
template struct Test7<int>;
OpenPOWER on IntegriCloud