c++/2478: false g++ error: incompatible types in assignment of `int * (*)[]' to `int *[0]'
kengole@us.ibm.com
kengole@us.ibm.com
Tue Apr 3 13:06:00 GMT 2001
>Number: 2478
>Category: c++
>Synopsis: false g++ error: incompatible types in assignment of `int * (*)[]' to `int *[0]'
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: rejects-legal
>Submitter-Id: net
>Arrival-Date: Tue Apr 03 13:06:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: Ken Gole
>Release: gcc version 2.95.3 20010315 (release)
>Organization:
>Environment:
Redhat 6.2 on i686 intel machine
>Description:
This simple program is a snippet of a much larger one, but
demonstrates our problem. g++ is confusing the types on an
assignment statement if the receiving variable is a
member of a structure.
>How-To-Repeat:
just do a g++ compile and see the error!
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/plain; name="tmi.C"
Content-Disposition: inline; filename="tmi.C"
/* A demonstration of a gcc 2.95.3 problem - KenGole@us.ibm.com */
#include <stdio.h>
int main(void)
{
int *(*ArryPtr)[]=NULL; /* A pointer to an array of pointers */
int *(*p)[]; /* Same type as ArryPtr */
struct myStruct
{
int *(p)[]; /* Same type as ArryPtr */
} B;
p=ArryPtr; /* This compiles fine... */
B.p=ArryPtr; /* This fails to compile! */
return 0;
}
More information about the Gcc-prs
mailing list