| 1 |
// { dg-do compile } |
| 2 |
// Origin: <sebor at roguewave dot com> |
| 3 |
// c++/8266: Explicit instantiation of a template outside its namespace is |
| 4 |
// broken |
| 5 |
|
| 6 |
namespace N |
| 7 |
{ |
| 8 |
template <class T> T foo (T) |
| 9 |
{ return T (); } |
| 10 |
|
| 11 |
struct A |
| 12 |
{ |
| 13 |
template <int N> |
| 14 |
struct B {}; |
| 15 |
}; |
| 16 |
|
| 17 |
template <int M> |
| 18 |
struct C {}; |
| 19 |
|
| 20 |
template double foo(double); |
| 21 |
template float foo<float>(float); |
| 22 |
template struct A::B<0>; |
| 23 |
template struct C<0>; |
| 24 |
} |
| 25 |
|
| 26 |
template int N::foo(int); |
| 27 |
template char N::foo<char>(char); |
| 28 |
template struct N::A::B<1>; |
| 29 |
template struct N::C<1>; |
| 30 |
|
| 31 |
|