is this a gcc bug or somehow wrong usage of parameter packs?
(Compiled with gcc 4.6.3 🙂
#include <iostream>
template<class...Ts> struct tuple{};
template<class...>class test;
template< template <class...> class tp,
class...arg1Ts,
class...arg2Ts>
class test<tp<arg1Ts...>,tp<arg2Ts...>>{
public:
void test1(arg1Ts... arg1s,arg2Ts... arg2s){
std::cout<<sizeof...(arg1s); //Why is this 2? Why not 0?
std::cout<<sizeof...(arg2s); //2 ok
}
};
int main(){
test<tuple<>,tuple<char,int>> t1; //(arg1Ts... = empty), (arg2Ts... = char,int)
t1.test1('a',2); //prints 22, not 02
}
I put here a compilable example:
(not much different from yours, but it compiles cleanly)
Using clang 3.0, this gives:
which is exactly what is expected. So I would figure a bug with the version of gcc you are using. Time to move on to 4.7 ?