This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/19991] New: [3.4/4.0 regression] Enum not accepted in array-size
- From: "reichelt at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 15 Feb 2005 23:15:03 -0000
- Subject: [Bug c++/19991] New: [3.4/4.0 regression] Enum not accepted in array-size
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
The following valid code snippet is rejected since gcc 3.4.0:
=================================
enum { e = 1 };
template<typename> struct A
{
static const int i = e;
char a[i];
};
=================================
The error message is:
bug.cc:6: error: size of array `a' is not an integral constant-expression
However, the ocde is accepted if I declare "e" as "const int" instead of an
enum value, or if I use "a[e]" instead of "a[i]", or if I make "A" a
non-template struct.
This is related tp PR19983.
--
Summary: [3.4/4.0 regression] Enum not accepted in array-size
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Keywords: rejects-valid, monitored
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: reichelt at gcc dot gnu dot org
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19991