This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
Re: c++/5805: [parser] the expression 'new (int*)[10]' should be a syntax error
- From: Moritz Franosch <jfranosc at physik dot tu-muenchen dot de>
- To: nobody at gcc dot gnu dot org
- Cc: gcc-prs at gcc dot gnu dot org,
- Date: 6 Mar 2002 10:36:05 -0000
- Subject: Re: c++/5805: [parser] the expression 'new (int*)[10]' should be a syntax error
- Reply-to: Moritz Franosch <jfranosc at physik dot tu-muenchen dot de>
The following reply was made to PR c++/5805; it has been noted by GNATS.
From: Moritz Franosch <jfranosc@physik.tu-muenchen.de>
To: rodrigc@gcc.gnu.org, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org,
gcc-gnats@gcc.gnu.org
Cc:
Subject: Re: c++/5805: [parser] the expression 'new (int*)[10]' should be a syntax error
Date: 06 Mar 2002 11:28:03 +0100
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