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]

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
>Closed-Date:
>Last-Modified:
>Originator:     Dimitri Papadopoulos
>Release:        gcc-3.2.2
>Organization:
>Environment:
Solaris 8 (7/01)
>Description:
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 foo.cc
"foo.cc", line 2: Error: Cannot use int* to initialize int**.
1 Error(s) detected.
$ 

$ CC -version
MIPSpro Compilers: Version 7.3.1.3m
$ CC -c foo.cc
cc-1140 CC: ERROR File = foo.cc, 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.
>How-To-Repeat:
$ g++ -Wall -c foo.c
$ 
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="foo.cc"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="foo.cc"

aW50IG1haW4oKSB7CiAgIGludCAqKmZvbyA9IG5ldyAoaW50KilbMzNdOwp9Cg==


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