gcc accepts following code.
Basically, this code specify template arguments to ordinary template parameter
pack(i.e. non template template parameter pack).
// given this primary template
template < typename ... Types >
class Foo { } ;
// gcc accepts this parcial specialization
// If I use template keyword.
template < typename ... Types, typename ... Params >
class Foo< template Types < Params... > ... >
{ } ;
// gcc also accepts this. the difference is position of template keyword.
template < typename ... Types, typename ... Params >
class Foo< Types template < Params... > ... >
{ } ;
This must be ill-formed.
The template keyword for the typename-specifier is for nested-name-specifier.
Types is not.
Types is not a template template parameter pack, yet it takes template
arguments if I use broken typename-specifier-like syntax.
When I found this, I wanted to write class template Foo which can be
instantiated like this:
Foo<
std::tuple<int, char, short>,
std::tuple<float>,
std::tuple<double, double>
> foo ;
It accepts any number of std::tuple types(or whatever class templates) with
each std::tuple take any number of template arguments in any type.
The obvious implementation of this is using template template parameter pack in
partial specialization.
template < typename ... Types >
class Foo { };
template <
template < typename ... > class ... Types,
typename ... Params
>
class Foo< Types< Params... > ... >
{ } ;
But I happened to write above ordinary template parameter pack version.
And found this bug.
--
Summary: gcc accepts ill-formed template code combining Variadic
Templates and Partial specialization
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: boostcpp at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45225