This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/19991] New: [3.4/4.0 regression] Enum not accepted in array-size


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]