commit 5b39abcbdeb088fe7c19c7ff1a280ca4f7876366
Author: Jason Merrill <jason@redhat.com>
Date: Fri Jan 13 12:39:40 2012 -0500
PR c++/51813
* decl2.c (constrain_visibility): Clear DECL_VISIBILITY_SPECIFIED
when reducing the visibility.
@@ -1984,6 +1984,8 @@ constrain_visibility (tree decl, int visibility, bool tmpl)
&& (tmpl || !DECL_VISIBILITY_SPECIFIED (decl)))
{
DECL_VISIBILITY (decl) = (enum symbol_visibility) visibility;
+ /* This visibility was not specified. */
+ DECL_VISIBILITY_SPECIFIED (decl) = false;
}
}
new file mode 100644
@@ -0,0 +1,14 @@
+// PR c++/51813
+// { dg-options -fvisibility=hidden }
+// { dg-final { scan-assembler-not "hidden\\s+_ZN1N1fI1AEEvT" } }
+
+struct A { };
+namespace N __attribute((visibility("default"))) {
+ template <class T> void f(T) { }
+ extern template void f(A);
+}
+
+int main()
+{
+ N::f(A());
+}