Mark Mitchell | 6481daa | 2003-05-01 02:02:59 +0000 | [diff] [blame] | 1 | // { dg-do run } |
Jason Merrill | 160387c | 1998-07-19 20:29:35 -0400 | [diff] [blame] | 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; |
Mark Mitchell | 876200a | 2002-12-28 07:48:15 +0000 | [diff] [blame] | 27 | z.g<long>(); |
Jason Merrill | 160387c | 1998-07-19 20:29:35 -0400 | [diff] [blame] | 28 | |
| 29 | Y<int> z1; |
| 30 | if (z1.f(5) != 2) |
| 31 | return 1; |
| 32 | return 0; |
| 33 | } |
| 34 | |