------- Comment #3 from redi at gcc dot gnu dot org 2009-08-26 14:51 ------- (In reply to comment #2) > IIUC, the top-level const qualifier on "const typename Foo<D>::double3" in the > primary template applies to the type, which is not known during phase 1
i.e. it's equivalent to "typename Foo<D>::double3 const" which is equivalent to simply "typename Foo<D>::double3) because top-level cv-qualifiers are removed from function parameters. but when double3 is known to be an array type, which is replaced by a pointer in a parameter list, then the declaration's meaning changes. Consider: typedef double double3[3]; void f(const double3); typedef void (*ptr)(const double*); ptr p = f; This demonstrates that the declaration of 'f' is equivalent to: void f(const double*); not void f(double* const); According to [dcl.fct] array parameters are replaced with pointers before top-level cv-qualifiers are deleted. I think GCC is correct, the template specializations are invalid. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40315