public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/5805: the expression 'new (int*)[10]' should be a syntax error
@ 2002-03-05  5:56 Craig Rodrigues
  0 siblings, 0 replies; 3+ messages in thread
From: Craig Rodrigues @ 2002-03-05  5:56 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: c++/5805: the expression 'new (int*)[10]' should be a syntax error
@ 2002-03-05  1:36 Moritz Franosch
  0 siblings, 0 replies; 3+ messages in thread
From: Moritz Franosch @ 2002-03-05  1: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: the expression 'new (int*)[10]' should be a syntax error
Date: 05 Mar 2002 10:29:57 +0100

 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
 
 Sorry, my report was confusing because I said g++ gives a warning. In
 fact g++ gives an error (for line (3)), which is correct behaviour.
 
 Nevertheless line (2) should, according to the standard, also give an
 error. But g++ does not generate an error for line (2), which is a
 bug.
 
 I've tried with gcc 3.0.4 and it behaves the same as gcc 3.0.2 in this
 case:
 
 start g++-new-bug-2.cpp
 int main() {
   int** p;
   p=new int*[10];     // 1
   p=new (int*)[10];   // 2 (should be a syntax error, but seems to
                       //    compile semantically equivalent to 1)
 }
 end g++-new-bug-2.cpp
 
 
 jfranosc@synapse:~/tmp/g++-new-bug > /lscratch/jfranosc/gcc/local/bin/g++ -v g++-new-bug-2.cpp
 Reading specs from /lscratch/jfranosc/gcc/local/lib/gcc-lib/i686-pc-linux-gnu/3.0.4/specs
 Configured with: ../gcc-3.0.4/configure --prefix=/lscratch/jfranosc/gcc/local
 Thread model: single
 gcc version 3.0.4
  /lscratch/jfranosc/gcc/local/lib/gcc-lib/i686-pc-linux-gnu/3.0.4/cc1plus -v -D__GNUC__=3
 -D__GNUC_MINOR__=0 -D__GNUC_PATCHLEVEL__=4 -D__ELF__ -Dunix -Dlinux -D__ELF__ -D__unix__ -D__linux__ -D__unix -D__linux -Asystem=posix -D__NO_INLINE__ -D__STDC_HOSTED__=1 -D_GNU_SOURCE -Acpu=i386 -Amachine=i386 -Di386 -D__i386 -D__i386__ -D__tune_i686__ -D__tune_pentiumpro__ g++-new-bug-2.cpp -D__GNUG__=3 -D__GXX_DEPRECATED -D__EXCEPTIONS -D__GXX_ABI_VERSION=100 -quiet -dumpbase g++-new-bug-2.cpp -version -o /tmp/ccFo2S3Y.s
 GNU CPP version 3.0.4 (cpplib) (i386 Linux/ELF)
 GNU C++ version 3.0.4 (i686-pc-linux-gnu)
         compiled by GNU C version 3.0.4.
 ignoring nonexistent directory "/lscratch/jfranosc/gcc/local/i686-pc-linux-gnu/include"
 #include "..." search starts here:
 #include <...> search starts here:
  /lscratch/jfranosc/gcc/local/include/g++-v3
  /lscratch/jfranosc/gcc/local/include/g++-v3/i686-pc-linux-gnu
  /lscratch/jfranosc/gcc/local/include/g++-v3/backward
  /usr/local/include
  /lscratch/jfranosc/gcc/local/include
  /lscratch/jfranosc/gcc/local/lib/gcc-lib/i686-pc-linux-gnu/3.0.4/include
  /usr/include
 End of search list.
  as --traditional-format -V -Qy -o /tmp/ccKNWSeP.o /tmp/ccFo2S3Y.s
 GNU assembler version 2.10.91 (i486-suse-linux) using BFD version 2.10.0.33
  /lscratch/jfranosc/gcc/local/lib/gcc-lib/i686-pc-linux-gnu/3.0.4/collect2 -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 /usr/lib/crt1.o /usr/lib/crti.o /lscratch/jfranosc/gcc/local/lib/gcc-lib/i686-pc-linux-gnu/3.0.4/crtbegin.o -L/lscratch/jfranosc/gcc/local/lib/gcc-lib/i686-pc-linux-gnu/3.0.4 -L/lscratch/jfranosc/gcc/local/lib/gcc-lib/i686-pc-linux-gnu/3.0.4/../../.. /tmp/ccKNWSeP.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /lscratch/jfranosc/gcc/local/lib/gcc-lib/i686-pc-linux-gnu/3.0.4/crtend.o /us r/lib/crtn.o
 
 
 G++ 3.0.4 compiles the program (with the missing line (3)) without any
 errors, as does g++ 3.0.2. But g++ should generate an error for line
 (2). For the reasons why I think line (2) is a syntax error please see
 my original report. I'm pretty shure that line (2) is not correct C++
 because of the replies I got on comp.std.c++.
 
 
 Thank you for your reply,
 
 Moritz


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: c++/5805: the expression 'new (int*)[10]' should be a syntax error
@ 2002-03-02 18:50 rodrigc
  0 siblings, 0 replies; 3+ messages in thread
From: rodrigc @ 2002-03-02 18:50 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, jfranosc, nobody

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
    

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:[~2002-03-05 13:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-03-05  5:56 c++/5805: the expression 'new (int*)[10]' should be a syntax error Craig Rodrigues
  -- strict thread matches above, loose matches on Subject: below --
2002-03-05  1:36 Moritz Franosch
2002-03-02 18:50 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).