vendredi 17 avril 2015

Default argument for partial specialization [Clang yes, GCC no]

Why does the following compile with clang but not with g++ 4.9



#include <array>

template< typename T1, typename T2 , typename T3 = int>
struct A;

template<typename T, unsigned int N, typename T2, typename T3>
struct A< std::array<T,N>, T2, T3 > {
int a;
};

int main()
{
A< std::array<int,10>, double> a;
a.a +=3;
}


http://ift.tt/1FS0KJf


g++ does not find a suitable specialization and complains with "incomplete type". I am wondering since, the default argument typename T3 = int should apply for the specialization (or does it only apply for full specialization?)


Aucun commentaire:

Enregistrer un commentaire