gcc/testsuite/g++.old-deja/g++.ns/template12.C
raw| 1 | // { dg-do assemble } |
| 2 | // Templates can be defined outside of the namespace if the have been declared |
| 3 | // inside |
| 4 | namespace bar |
| 5 | { |
| 6 | template <typename T> |
| 7 | T const foo(T const &); |
| 8 | template<> const int foo<int>(int const &); |
| 9 | } |
| 10 | |
| 11 | template <typename T> |
| 12 | T const |
| 13 | bar::foo(T const &a) |
| 14 | { |
| 15 | return a; |
| 16 | } |
| 17 | |
| 18 | template<> const int bar::foo<int>(int const &){return 0;} |
| 19 |