This is the mail archive of the gcc-prs@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]

c++/290: Re: Incorrect warning



>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:

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