[Bug c++/52008] [C++0x] ICE when adding partial specialization for variadic-templated structure

jason at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sat Apr 21 01:48:00 GMT 2012


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52008

--- Comment #7 from Jason Merrill <jason at gcc dot gnu.org> 2012-04-21 01:46:29 UTC ---
If you rewrite the test so that the two versions are both partial
specializations:

template <size_t, typename...> struct tuple_sliced;

template <size_t B, typename Type1, typename... Types>
struct tuple_sliced<B, Type1, Types...>
{
    typedef typename tuple_sliced<B-1, Types...>::type type;
};

template<typename... Types>
struct tuple_sliced<0, Types...>  // <-- line 18
{
    typedef tuple<Types...> type;
};

and then you try to instantiate it:

tuple_sliced<1,int,int,int> t;

the instantiation is ambiguous.  The second partial specialization is more
specialized for the first argument "0", but the first partial specialization is
more specialized for the parameter pack, because it requires at least one
argument.  So neither is more specialized than the other, and so in the same
way in the original testcase the partial specialization is not more specialized
than the primary template.



More information about the Gcc-bugs mailing list