| 1 |
// PR c++/89744 |
| 2 |
|
| 3 |
namespace N1 { |
| 4 |
template<typename> struct A |
| 5 |
{ |
| 6 |
template<typename> struct B {}; |
| 7 |
A() { B<int> b; } |
| 8 |
}; |
| 9 |
|
| 10 |
template<> template<typename> |
| 11 |
struct A<int>::B |
| 12 |
{ |
| 13 |
virtual void foo() {} |
| 14 |
}; |
| 15 |
|
| 16 |
A<int> a; |
| 17 |
} |
| 18 |
|
| 19 |
namespace N2 { |
| 20 |
template<typename> struct A |
| 21 |
{ |
| 22 |
template<typename> struct B {}; |
| 23 |
A() { B<int> b; } |
| 24 |
}; |
| 25 |
|
| 26 |
template<> template<typename> |
| 27 |
struct A<int>::B |
| 28 |
{ |
| 29 |
virtual void foo() {} |
| 30 |
void bar() {} |
| 31 |
}; |
| 32 |
|
| 33 |
A<int> a; |
| 34 |
} |
| 35 |
|
| 36 |
namespace N3 { |
| 37 |
template<typename> struct A |
| 38 |
{ |
| 39 |
template<typename> struct B {}; |
| 40 |
A() { B<int> b; } |
| 41 |
}; |
| 42 |
|
| 43 |
template<> template<typename> |
| 44 |
struct A<int>::B |
| 45 |
{ |
| 46 |
~B() {} |
| 47 |
}; |
| 48 |
|
| 49 |
A<int> a; |
| 50 |
} |
| 51 |
|
| 52 |
#if __cpp_variadic_templates |
| 53 |
namespace N4 { |
| 54 |
template<typename...> struct A |
| 55 |
{ |
| 56 |
template<typename> struct B {}; |
| 57 |
typedef B<int> X; |
| 58 |
}; |
| 59 |
|
| 60 |
template<> template<typename> |
| 61 |
struct A<int>::B |
| 62 |
{ |
| 63 |
typedef int Y; |
| 64 |
}; |
| 65 |
|
| 66 |
A<int>::B<int> b; |
| 67 |
} |
| 68 |
#endif |