llvm/clang-pr11642.patch

32 lines
1.2 KiB
Diff

Index: test/CodeGenCXX/visibility-inlines-hidden.cpp
===================================================================
--- test/CodeGenCXX/visibility-inlines-hidden.cpp (revision 147294)
+++ test/CodeGenCXX/visibility-inlines-hidden.cpp (revision 147295)
@@ -97,3 +97,14 @@
// CHECK: define available_externally void @_ZN5test22ns3fooINS_1BINS_1AEEEEEvv()
}
+
+namespace PR11642 {
+ template <typename T>
+ class Foo {
+ public:
+ T foo(T x) { return x; }
+ };
+ extern template class Foo<int>;
+ template class Foo<int>;
+ // CHECK: define weak_odr i32 @_ZN7PR116423FooIiE3fooEi
+}
Index: lib/AST/Decl.cpp
===================================================================
--- lib/AST/Decl.cpp (revision 147294)
+++ lib/AST/Decl.cpp (revision 147295)
@@ -568,6 +568,7 @@
// about whether containing classes have visibility attributes,
// and that's intentional.
if (TSK != TSK_ExplicitInstantiationDeclaration &&
+ TSK != TSK_ExplicitInstantiationDefinition &&
F.ConsiderGlobalVisibility &&
MD->getASTContext().getLangOptions().InlineVisibilityHidden) {
// InlineVisibilityHidden only applies to definitions, and