Given this code: template<typename T, T N> struct int_ { static const T value = N; typedef int_< T, static_cast<T>(value+1) > next; };
GCC says: intconst2.cc:3: error: template argument 2 is invalid It works if you replace "value" with "N". Possibly related to recent changes to C++ parser disallow floating-point literals in integral-constant expressions? Appeared around the same time. This causes compilation failures in Boost.MPL -- Summary: Error with integral-constant expression in template Product: gcc Version: 4.0.0 Status: UNCONFIRMED Keywords: rejects-valid Severity: normal Priority: P2 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: redi at gcc dot gnu dot org CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20261