This is the mail archive of the 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]

c++/9658: compiler accepts invalid code

>Number:         9658
>Category:       c++
>Synopsis:       compiler accepts invalid code
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          accepts-illegal
>Submitter-Id:   net
>Arrival-Date:   Tue Feb 11 10:26:00 UTC 2003
>Originator:     Dimitri Papadopoulos
>Release:        gcc-3.2.2
Solaris 8 (7/01)
Sun and SGI compilers emit an error on the attached code:

$ CC -V
CC: Sun WorkShop 6 update 2 C++ 5.3 Patch 111685-12 2002/12/16
$ CC -c
"", line 2: Error: Cannot use int* to initialize int**.
1 Error(s) detected.

$ CC -version
MIPSpro Compilers: Version
$ CC -c
cc-1140 CC: ERROR File =, Line = 2
  A value of type "int *" cannot be used to initialize an entity of type "int **"

     int **foo = new (int*)[33];

The GNU compiler doesn't.

The Sun engineers insist this is not legal code.
$ g++ -Wall -c foo.c

Content-Type: application/octet-stream; name=""
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename=""


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