The following code:
#include <cstddef>
template <size_t N,
typename T,
T first,
T... rest>
struct A {
};
template<typename T,
T... args>
struct A<0, T, args...> {
};
int main () {
A<0, int, 1> a0;
A<2, int, 1, 2> a2;
return 0;
}
...does not compile with g++
(version 5.1.0
and 5.3.0
) due to:
error: partial specialization is not more specialized than the primary template because it replaces multiple parameters with a pack expansion
...but compiles with clang
.
Is it allowed to declare such partial specializations?
Side note: Actually, the specialization is dangerous since A<0, int>
fails to compile with both compiler (wrong number of template arguments).
Aucun commentaire:
Enregistrer un commentaire