hi, the following code compiled properly in 3.3.5: #begin code
/* bind 2nd parameter in a 2 parameters metafunction */ template< template<typename A, typename B> class MetaFunc, typename B> struct bind_2 { template<typename T> struct bound { typedef typename MetaFunc<T,B>::type type; }; }; template<typename A, typename B> struct Fx{ /* refer int 2 steps to Fx<A,int> */ typedef typename bind_2< Fx, int >::template bound<A>::type type; }; template<typename A> struct Fx<A,int>{ typedef double type; }; #end code When compiling with gcc 3.4.3 or 4.1 (recent CVS) i get: bug.cpp:16: error: type/value mismatch at argument 1 in template parameter list for `template<template<class A, class B> class MetaFunc, class B> struct bind_2' bug.cpp:16: error: expected a class template, got `Fx<A, B>' bug.cpp:16: error: expected unqualified-id before "template" The strange thing is that if Fx is defined bi-recursively (instead that recursively) it compiles on 3.4 and 4.1 too: This is the working workaround: #begin code template<typename A, typename B> struct Fx; template<typename A, typename B> struct Fy; template<typename A, typename B> struct Fx{ typedef typename bind_2< Fy, int >::template bound<A>::type type; }; template<typename A> struct Fx<A,int>{ typedef double type; }; template<typename A, typename B> struct Fy{ typedef typename bind_2< Fx, int >::template bound<A>::type type; }; template<typename A> struct Fy<A,int>{ typedef double type; }; #end code -- Summary: template mismatch in 3.4 and 4.1 Product: gcc Version: 3.4.3 Status: UNCONFIRMED Severity: normal Priority: P2 Component: regression AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: monge at sns dot it CC: gcc-bugs at gcc dot gnu dot org GCC build triplet: i386-pc-linux GCC host triplet: i386-pc-linux GCC target triplet: i386-pc-linux http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21740