This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
c++/290: Re: Incorrect warning
- To: gcc-gnats at gcc dot gnu dot org
- Subject: c++/290: Re: Incorrect warning
- From: "Martin v. Loewis" <martin at loewis dot home dot cs dot tu-berlin dot de>
- Date: Thu, 8 Jun 2000 08:27:14 +0200
- References: <393EDF9C.FE9DA646@roguewave.com>
- Resent-Cc: gcc-prs at gcc dot gnu dot org, bjorn at roguewave dot com
- Resent-Reply-To: gcc-gnats@gcc.gnu.org, "Martin v. Loewis" <martin@loewis.home.cs.tu-berlin.de>
>Number: 290
>Category: c++
>Synopsis: Incorrect warning
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: analyzed
>Class: rejects-legal
>Submitter-Id: net
>Arrival-Date: Wed Jun 07 23:36:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator: Bjorn Pettersen <bjorn@roguewave.com>
>Release: 2.95.2
>Organization:
>Environment:
>Description:
Original-Message-ID: <393EDF9C.FE9DA646@roguewave.com>
Date: Wed, 07 Jun 2000 17:49:48 -0600
I've discovered an incorrect warning about using enumerations in array
new expressions when compiling with -Wall -pedantic.
The following code:
int* f() {
enum {s=10};
int* b = new int[s];
return b;
}
Gives the following warning:
warning: size in array new must have integral type
Section 5.3.4 of the standard defines direct-new-declarator as:
direct-new-declarator:
[ expression ]
direct-new-declarator [ constant-expression ]
and, 5.19.1 goes on to say
An integral constant-expression can involve only literals
(lex.literal), enumerators, const ...
gcc -v gives:
gcc version 2.95.2 19991024 (release)
Sincerely,
Bjorn Pettersen
Tech Lead, Tools.h++
Rogue Wave Software, Inc.
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: