https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69978
Bug ID: 69978 Summary: Invalid sizeof... value for variadic template arguments Product: gcc Version: 5.2.0 Status: UNCONFIRMED Severity: major Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: yanikibo at yandex dot com Target Milestone: --- #include <cstddef> #include <cassert> template < std::size_t N > struct A { enum : std::size_t { value = N }; }; template < class... TL > using B = A< sizeof...(TL) >; template < class T > struct C { using type = T; }; template < class... TL > using D = typename C< B<TL...> >::type; template < class T, class U, class... TL > void foo( T, U, TL... ) { assert( (B<T, U, TL...>::value) == (2 + sizeof...(TL)) ); // failed(g++4.7) passed(g++4.8+) assert( (D<T, U, TL...>::value) == (2 + sizeof...(TL)) ); // failed(g++4.7) passed(g++4.8+) assert( (C< B<T, U, TL...> >::type::value) == (2 + sizeof...(TL)) ); // failed(g++4.7+) } int main() { foo(10, 20, 30, 40, 50); }