The following code doesn't compile unless variable RUNTIME is defined as a "static const int" instead of an "enum":
#include <type_traits> enum { RUNTIME = 0 }; // it compiles with the previous line commented out and the next commented in // static const int RUNTIME=0; template <class T, class U, class EN=void> struct foo; template <template<int> class V, int M> struct foo<V<M>,V<M>, typename std::enable_if<M==RUNTIME || M==2>::type> {}; template <template<int> class V1, template<int> class V2, int M> struct foo<V1<M>,V2<M>, typename std::enable_if<M==RUNTIME || M==2>::type> {}; template <int M> struct bar {}; foo<bar<2>,bar<2>> x; -- Summary: Invalid ambiguity on partial class specialization matching Product: gcc Version: 4.5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: rodolfo at rodsoft dot org GCC build triplet: x86_64-pc-linux-gnu GCC host triplet: x86_64-pc-linux-gnu GCC target triplet: x86_64-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45012