summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/ext/visibility/template2.C
blob: 8db96db564942a6f09af1154e590971b370ab88e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// PR c++/27000
// Implicitly instantiated templates should not be affected by
// #pragma visibility.

/* { dg-do compile } */
/* { dg-require-visibility "" } */
/* { dg-final { scan-not-hidden "_ZN1SIiED1Ev" } } */
/* { dg-final { scan-not-hidden "_ZN1SIiEC1ERKi" } } */

template <class T>
struct S
{
  S (const T &);
  ~S ();
  T t;
};

template <class T>
S<T>::S (const T &x)
{
  t = x;
}

template <class T>
S<T>::~S ()
{
}

#pragma GCC visibility push(hidden)
struct U
{
  S<int> s;
  U () : s (6) { }
} u;
#pragma GCC visibility pop