1
votes

My GCC 4.9.1 does not give an error about this:

#include <iostream>

template<typename _Tp, typename... _Args>
  struct IsCble { };

template<typename _Tp>
  struct IsCble<_Tp> { static constexpr int value {4}; };

int main()
{
    std::cout << IsCble<int>::value << std::endl;

    return 0;
}

The same with GCC 5.1. But they should according to:

[temp.class.spec] 14.5.5\8.4

— The specialization shall be more specialized than the primary template.

I think, in the code above the partial specialization is not more specialized than the primary template, because of:

[temp.deduct.type] 14.8.2.5\9.1

— if P does not contain a template argument corresponding to Ai then Ai is ignored;

So it seems, they ignore 14.5.5\8.4 and resolve the ambiguity by:

[temp.class.spec.match] 14.5.5.1\1

This is done by matching the template arguments of the class template specialization with the template argument lists of the partial specializations.

Is it a conforming implementation (1.4\8)?

1

1 Answers

1
votes

An omitted parameter is supposed to be more specialised than an empty parameter pack. The same question in a different context is the subject of an open issue:

CWG agreed that the example should be accepted, handling this case as a late tiebreaker, preferring an omitted parameter over a parameter pack.

So you're right based on the current text of the standard, but there's little point in compilers being adjusted to follow the current rules when those rules are expected to change.