[Bug c/71963] New: Showing incompatible type when types are same.
sinu.nayak2001 at gmail dot com
gcc-bugzilla@gcc.gnu.org
Thu Jul 21 19:30:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71963
Bug ID: 71963
Summary: Showing incompatible type when types are same.
Product: gcc
Version: 4.6.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: sinu.nayak2001 at gmail dot com
Target Milestone: ---
#include <stdio.h>
int main()
{
int k[3][3] = {{1,2,3},{4,5,6},{7,8,9}};
int (*c)[3];
int (*d)[3];
c = k+1;
d = k+2;
*c = *d; //error: incompatible types when assigning to type 'int[3]'
from type 'int *'
k[0] = k[1]; //error: incompatible types when assigning to type
'int[3]' from type 'int *'
printf("%d\n", (*c)[0]);
printf("%d\n", (*d)[0]);
return 0;
}
In the above code, errors are shown as commented.
No doubt, it is a tricky attempt to assign an array to another array.
However, aren't the types of both left hand side and right hand side same?
Sincerely,
Srinivas Nayak
More information about the Gcc-bugs
mailing list