http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47897
Summary: [C++0x] static const member variable is not constant expression Product: gcc Version: 4.6.0 Status: UNCONFIRMED Severity: major Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: fl...@flast.jp GCC4.6.0(with C++0x mode) reject static const member variable depending template parameter type. ---- testcase.C ---- template < typename T, T N > struct S { static const T value = N; typedef S< T, value + 1 > next; }; -------------------- It seems caused by r170488 (git: cfa61f8435164f3205d70c7e1c5038b2d881aa1d). In other case, GCC accepts codes. For example: ---- testcase.C (accepted) ---- template < int N > struct S { static const int value = N; typedef S< value + 1 > next; }; ------------------------------- Another case: ---- testcase.C (accepted) ---- template < typename T, T N > struct S { static constexpr T value = N; typedef S< T, value + 1 > next; }; -------------------------------