OSDN Git Service

PR c++/26905
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.dg / ext / visibility / template3.C
1 // PR c++/17470
2 // Test that we can give visibility to explicit template instantiations
3
4 // { dg-require-visibility "" }
5 // { dg-final { scan-hidden "_ZN1AIlE1fEl" } }
6 // { dg-final { scan-hidden "_ZN1AIiE1fEi" } }
7 // { dg-final { scan-not-hidden "_ZN1AIcE1fEc" } }
8 // { dg-final { scan-hidden "_Z8identityIdET_S0_" } }
9 // { dg-final { scan-not-hidden "_Z8identityIiET_S0_" } }
10
11 template <class T> T identity(T t) { return t; }
12 template  __attribute__((visibility("hidden"))) double identity(double);
13 template int identity(int);
14
15
16 template <class T> struct A { void f (T); };
17 template <class T> void A<T>::f (T) { }
18 template struct __attribute ((visibility ("hidden"))) A<int>;
19 template<> struct  __attribute ((visibility ("hidden"))) A<long> { void f(long); };
20 // inherits hidden visibility from its class
21 void A<long>::f (long) { }
22 template struct A<char>;