My question is about the following code snippet:
template <class...T> class A { public: template <class...S> static void a() { } }; template <class...T> class B { public: template <class...S> void b() { A<T...>::a<S...>(); } }; int main(int argc, char** argv) { return 0; }
I have a class A that has a variational pattern and contains a static method A that has a different variational pattern. From another place (class B in this case) I have two different sets of variation patterns that I want to pass to A::a .
The following error message appears in the compiler (GCC 4.8.1):
main.cpp: In static member function 'static void B<T>::b()': main.cpp:16:22: error: expected primary-expression before '...' token A <T...>::a<S...>(); ^ main.cpp:16:22: error: expected ';' before '...' token
Also note that when changing the b() method to this:
void b() { A<int, char, short>::a<S...>(); }
or some other template specification A, then the code compiles just fine.
What is wrong with the code above?
source share