This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: c++/5805: the expression 'new (int*)[10]' should be a syntax error
- From: Craig Rodrigues <rodrigc at attbi dot com>
- To: Moritz Franosch <jfranosc at physik dot tu-muenchen dot de>
- Cc: rodrigc at gcc dot gnu dot org, gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, gcc-gnats at gcc dot gnu dot org
- Date: Tue, 5 Mar 2002 08:48:40 -0500
- Subject: Re: c++/5805: the expression 'new (int*)[10]' should be a syntax error
- References: <20020303024958.3156.qmail@sources.redhat.com> <rxxzo1n1hwq.fsf@synapse.t30.physik.tu-muenchen.de>
On Tue, Mar 05, 2002 at 10:29:57AM +0100, Moritz Franosch wrote:
>
> rodrigc@gcc.gnu.org writes:
>
> > Synopsis: the expression 'new (int*)[10]' should be a syntax error
> >
> > State-Changed-From-To: open->closed
> > State-Changed-By: rodrigc
> > State-Changed-When: Sat Mar 2 18:49:58 2002
> > State-Changed-Why:
> > With gcc 3.0.4, I get a compilation error:
> > ++-new-bug.cpp: In function `int main()':
> > g++-new-bug.cpp:6: cannot convert `int*' to `int**' in assignment
Your code is buggy. This is the result of compiling
with the Comeau C++ compiler:
"11912.c", line 4: error: a value of type "int *" cannot be assigned to an
entity of type "int **"
p=new (int*)[10]; // (2)
^
"11912.c", line 5: error: a value of type "int *" cannot be assigned to an
entity of type "int **"
p=(new (int*))[10]; // (3)
^
"11912.c", line 2: warning: variable "p" was set but never used
int** p;
--
Craig Rodrigues
http://www.gis.net/~craigr
rodrigc@attbi.com