Specializing a variadic template template parameter on the minimum number of arguments: legal or not?

后端 未结 2 909
傲寒
傲寒 2021-02-19 02:39

I have code:

#include 

template class>
struct Foo 
{ 
    enum { n = 77 };
};

template

        
2条回答
  •  春和景丽
    2021-02-19 03:29

    Clang is wrong to reject the partial specialization. To know how to interpret the errormessage, you need to understand what clang diagnoses. It means to diagnose a partial specialization whose arguments match exactly the implicit argument list of the primary class template ().

    However the argument lists are differently so clang shall not diagnose it. In particular this has nothing to do wheter the partial specialization matches more or less arguments. Consider

    template class C;
    template class C {};
    

    The partial specialization here matches everything and not more that the primary template would match. And the argument lists of both templates are different so this partial specialization is valid, just like you'rs.

提交回复
热议问题