[cfe-dev] [clang++] GCC/clang difference

Nate Knight Nate.Knight at numerica.us
Mon Dec 20 13:54:31 PST 2010


I have a question regarding the following code:

template<typename T>
struct A 
{
    const static int type;
};

template<typename T>
struct B 
{
    typedef A<T> C;
};

typedef B<int>::C D;
//const int D::type = 2;
template<> const int D::type = 2;

int main()
{
    B<int> b;
}

gcc 4.5 and 4.6(beta) require the "template<>" in front of "const in D::type = 2" with the error "error: specializing member 'A<int>::type' requires 'template<>' syntax"

gcc 4.3 and 4.4 give the error "too few template-parameter-lists"

clang++ (trunk 121734) gives an error if the "template<>" is present.

Can someone point me to the relevant section of the standard defining the required behavior here?  I'm trying to determine where to submit an issue report.

Thanks
Nate Knight



More information about the cfe-dev mailing list