public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/5805: [parser] the expression 'new (int*)[10]' should be a syntax error
@ 2002-03-06 2:36 Moritz Franosch
0 siblings, 0 replies; 3+ messages in thread
From: Moritz Franosch @ 2002-03-06 2:36 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: c++/5805: [parser] the expression 'new (int*)[10]' should be a syntax error
@ 2003-01-23 7:13 mmitchel
0 siblings, 0 replies; 3+ messages in thread
From: mmitchel @ 2003-01-23 7:13 UTC (permalink / raw)
To: gcc-bugs, gcc-prs, jfranosc, nobody
Synopsis: [parser] the expression 'new (int*)[10]' should be a syntax error
State-Changed-From-To: analyzed->closed
State-Changed-By: mmitchel
State-Changed-When: Thu Jan 23 07:13:03 2003
State-Changed-Why:
This G++ extension has been removed in GCC 3.4.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5805
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: c++/5805: [parser] the expression 'new (int*)[10]' should be a syntax error
@ 2002-03-05 18:45 rodrigc
0 siblings, 0 replies; 3+ messages in thread
From: rodrigc @ 2002-03-05 18:45 UTC (permalink / raw)
To: gcc-bugs, gcc-prs, jfranosc, nobody
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.
In parse.y,
/* GNU extension to allow arrays of arbitrary types with
non-constant dimension. */
| '(' type_id ')' '[' expr ']'
{
if (pedantic)
pedwarn ("ISO C++ forbids array dimensions with parenthesized type in new");
$$.t = build_nt (ARRAY_REF, TREE_VALUE ($2.t), $5);
$$.t = build_tree_list (TREE_PURPOSE ($2.t), $$.t);
$$.new_type_flag = $2.new_type_flag;
}
According to Paolo, the new C++ parser produces the
following error:
bug.cc:4: expected `;'
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5805
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2003-01-23 7:13 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-03-06 2:36 c++/5805: [parser] the expression 'new (int*)[10]' should be a syntax error Moritz Franosch
-- strict thread matches above, loose matches on Subject: below --
2003-01-23 7:13 mmitchel
2002-03-05 18:45 rodrigc
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).