This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/20261] New: Error with integral-constant expression in template
- From: "redi at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 1 Mar 2005 14:23:09 -0000
- Subject: [Bug c++/20261] New: Error with integral-constant expression in template
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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