Failing case comes from regression testing using Boost uBLAS with gcc4.0.2 prerelease: Using built-in specs. Target: x86_64-unknown-linux-gnu Configured with: ../gcc-4.0.2-20050913/configure --prefix=/home/michael/locacc402 Thread model: posix gcc version 4.0.2 20050913 (prerelease) The failure in this case is caused by BOOST_STATIC_ASSERT (foo_template<int>::complexity == 0); where foo_template is defined thus: template <class T> struct foo_template { public: static const unsigned complexity = 0; }; N.B. failure only occurs if foo_template is a template class. Suggestive is that if 'foo_template::complexity' encountered anyware by the compiler prior to the failing instantiation then problem disappers. Therefore const unsigned a = foo_template<int>::complexity; BOOST_STATIC_ASSERT (foo_template<int>::complexity == 0); is instantiated without error! Minimal test case without Boost headers is: template <class T> struct foo_template { static const unsigned complexity = 0; }; template <int x> struct STATIC_ASSERTION {}; void gcc_402_problem_minimal() { sizeof(STATIC_ASSERTION< foo_template<int>::complexity >); } cc402.cpp: In function ‘void gcc_402_problem_minimal()’: gcc402.cpp:10: error: ‘foo_template<int>::complexity’ is not a valid template argument for type ‘int’ because it is a non-constant expression
-- Summary: [4.0 Regression] further 'non-constant' template argument case exposed by Boost Product: gcc Version: 4.0.2 Status: UNCONFIRMED Severity: normal Priority: P2 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: mail at michael-stevens dot de CC: gcc-bugs at gcc dot gnu dot org GCC target triplet: x86_64-unknown-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23914