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]
Other format: [Raw text]

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


The following reply was made to PR c++/5805; it has been noted by GNATS.

From: Craig Rodrigues <rodrigc@attbi.com>
To: Moritz Franosch <jfranosc@physik.tu-muenchen.de>
Cc: rodrigc@gcc.gnu.org, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org,
   gcc-gnats@gcc.gnu.org
Subject: Re: c++/5805: the expression 'new (int*)[10]' should be a syntax error
Date: Tue, 5 Mar 2002 08:48:40 -0500

 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


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