This compiles:
class A {
public:
template <int, int> class B;
};
template <int y, int z = y>
class A::B {
};
int main() {}
This doesn’t:
template <int x>
class A {
public:
template <int, int> class B;
};
template <int x>
template <int y, int z = y>
class A<x>::B {
};
int main() {}
g++ main.cpp
says: (version 9.1.0)
main.cpp:24:13: error: default argument for template parameter for class enclosing ‘class A<x>::B<<anonymous>, <anonymous> >’
24 | class A<x>::B {
| ^
What’s wrong?