GCC Bugzilla will be upgraded from version 4.4.9 to 5.0rc3 on Saturday, April 25, starting around 17:00 UTC. The upgrade process should only last a few minutes. Check bug 64968 for details.
View | Details | Raw Unified | Return to bug 35688
Collapse All | Expand All | Context: (Patch / File /
)

(-)a/gcc/cp/decl2.c (-12 / +12 lines)
 Lines 1-12    Link Here 
1
   specified (or if VISIBILITY is static).  */
1
   specified (or if VISIBILITY is static).  If TMPL is true, this
2
   constraint is for a template argument, and takes precedence
3
   over explicitly-specified visibility on the template.  */
2
static bool
4
static void
3
constrain_visibility (tree decl, int visibility)
5
constrain_visibility (tree decl, int visibility, bool tmpl)
4
	   && !DECL_VISIBILITY_SPECIFIED (decl))
6
	   && (tmpl || !DECL_VISIBILITY_SPECIFIED (decl)))
5
      return true;
7
	constrain_visibility (decl, vis, true);
6
  return false;
7
	constrain_visibility (decl, vis);
8
	    constrain_visibility (decl, underlying_vis);
8
	    constrain_visibility (decl, underlying_vis, false);
9
	    (decl, type_visibility (TREE_TYPE (DECL_NAME (decl))));
9
	    (decl, type_visibility (TREE_TYPE (DECL_NAME (decl))), false);
10
    constrain_visibility (decl, VISIBILITY_ANON);
10
    constrain_visibility (decl, VISIBILITY_ANON, false);
11
	constrain_visibility (decl, tvis);
11
	constrain_visibility (decl, tvis, false);
12
    constrain_visibility (decl, VISIBILITY_ANON);
12
    constrain_visibility (decl, VISIBILITY_ANON, false);
(-)a/gcc/cp/pt.c (+2 lines)
Line 1    Link Here 
1
      /* Adjust visibility for template arguments.  */
2
      determine_visibility (TYPE_MAIN_DECL (type));
(-)a/gcc/testsuite/g++.dg/ext/visibility/template7.C (+29 lines)
Line 1    Link Here 
1
// PR c++/35688
2
// { dg-require-visibility "" }
3
// { dg-options "-fvisibility=hidden" }
4
5
// { dg-final { scan-hidden "_ZN1s6vectorI1AEC1Ev" } }
6
// { dg-final { scan-hidden "_ZN1s3fooI1AEEvT_" } }
7
8
namespace s __attribute__((visibility("default"))) {
9
  template <class T>
10
    class vector {
11
  public:
12
    vector() { }
13
  };
14
  template <class T>
15
    void foo(T t) {
16
  }
17
}
18
19
class A {
20
public:
21
  A() { }
22
};
23
24
s::vector<A> v;
25
26
int main() {
27
  A a;
28
  s::foo(a);
29
}
(-)a/gcc/testsuite/g++.dg/ext/visibility/template8.C (+26 lines)
Line 1    Link Here 
1
// PR c++/35688
2
// { dg-require-visibility "" }
3
// { dg-options "-fvisibility=hidden" }
4
5
// { dg-final { scan-hidden "_Z1gI1BEvT_" } }
6
// { dg-final { scan-hidden "_Z1gI1AI1BEEvT_" } }
7
8
// Test that template argument visibility takes priority even over an
9
// explicit visibility attribute on a template.
10
11
template <class T>
12
struct __attribute ((visibility ("default"))) A { };
13
template <class T>
14
void g(T) __attribute ((visibility ("default")));
15
16
struct B { };
17
18
template <class T>
19
void g(T)
20
{ }
21
22
int main()
23
{
24
  g(B());
25
  g(A<B>());
26
}