gcc/testsuite/g++.old-deja/g++.ns/template5.C
raw| 1 | // { dg-do run } |
| 2 | //Check whether namespace-scoped template instantiations |
| 3 | //are mangled differently. |
| 4 | |
| 5 | namespace X{ |
| 6 | template<class T> |
| 7 | struct Y{ |
| 8 | int f(T){ |
| 9 | return 1; |
| 10 | } |
| 11 | template<class X>void g(){} |
| 12 | }; |
| 13 | } |
| 14 | |
| 15 | template<class T> |
| 16 | struct Y{ |
| 17 | int f(T){ |
| 18 | return 2; |
| 19 | } |
| 20 | }; |
| 21 | |
| 22 | int main() |
| 23 | { |
| 24 | X::Y<int> z; |
| 25 | if (z.f(4) != 1) |
| 26 | return 1; |
| 27 | z.g<long>(); |
| 28 | |
| 29 | Y<int> z1; |
| 30 | if (z1.f(5) != 2) |
| 31 | return 1; |
| 32 | return 0; |
| 33 | } |
| 34 |