I am scratching my head with a strange problem highlighted by the following minimal code:
struct A {
template <typename ...X, typename ...Y>
void f(X... a, Y...b) {
}
template <typename ...X>
void g(X...c) {
f<X...> (c...);
}
};
template <typename T>
struct B {
template <typename ...X, typename ...Y>
void f(X... a, Y...b) {
}
template <typename ...X>
void g(X...c) {
f<X...> (c...);
}
};
int main() {
A a;
a.g(); // Compiles without problem
B<int> b;
b.g(); // Compiler complains saying g() calls f<>() with 0 arguments while 1 is expected
}
Both g++ and clang++ give the same basic error messages for the second case.
They basically say that the call to f() within the templated class needs one argument.
Is this a bug in both compilers, or am I missing something in the C++ standard?
The method taking two parameter packs is illegal according to 14.1 [temp.param] paragraph 11: