This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/47897] New: [C++0x] static const member variable is not constant expression
- From: "flast at flast dot jp" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 25 Feb 2011 21:16:56 +0000
- Subject: [Bug c++/47897] New: [C++0x] static const member variable is not constant expression
- Auto-submitted: auto-generated
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: unassigned@gcc.gnu.org
ReportedBy: flast@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;
};
-------------------------------