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]

Re: c++/5805: [parser] the expression 'new (int*)[10]' should be a syntax error



rodrigc@gcc.gnu.org writes:

> Old Synopsis: the expression 'new (int*)[10]' should be a syntax error
> New Synopsis: [parser] the expression 'new (int*)[10]' should be a syntax error
> 
> State-Changed-From-To: closed->analyzed
> State-Changed-By: rodrigc
> State-Changed-When: Tue Mar  5 18:45:52 2002
> State-Changed-Why:
>     For the following testcase, bug.c:
>     int main() {
>       int** p;
>       p = new int* [10];
>       p = new (int*) [10];
>     }
>     
>     If compiled with:
>     g++ bug.cc                ->  NO ERROR
>     
>     If compiled with
>     g++ -pedantic-errors bug.cc
>     bug.cc:ISO C++ forbids array dimensions with parenthesized type in new
>     
>     
>     This is apparently a gcc extension.

Sorry, I didn't think it could be an extension (although the behaviour
of g++ in this case seemed logical to me and I've always used it),
will better use '-pedantic' in the future.

So Intel C++ 5.0.4 didn't get it right (if compiled with -ansi Intel reports
an error instead of a warning, but the error is still the wrong
error), but g++ did. Very good, g++-team!

Thank you for your support.

Moritz


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