ignore size of arrays on ptr-to-array conversions
This commit is contained in:
parent
8cc1848e5c
commit
5ca741056d
|
@ -0,0 +1,8 @@
|
|||
int (*ptr2)[2];
|
||||
int (*ptrX)[];
|
||||
|
||||
int main()
|
||||
{
|
||||
ptrX=ptr2;
|
||||
ptr2=ptrX;
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
CORE
|
||||
conversion.c
|
||||
--verbosity 3
|
||||
^EXIT=0$
|
||||
^SIGNAL=0$
|
||||
--
|
||||
incompatible pointer types
|
||||
^CONVERSION ERROR$
|
|
@ -543,6 +543,13 @@ void c_typecastt::implicit_typecast_followed(
|
|||
// Also generous: between any to scalar types it's ok.
|
||||
// We should probably check the size.
|
||||
}
|
||||
else if(src_sub.id()==ID_array &&
|
||||
dest_sub.id()==ID_array &&
|
||||
base_type_eq(src_sub.subtype(), dest_sub.subtype(), ns))
|
||||
{
|
||||
// we ignore the size of the top-level array
|
||||
// in the case of pointers to arrays
|
||||
}
|
||||
else
|
||||
warnings.push_back("incompatible pointer types");
|
||||
|
||||
|
|
Loading…
Reference in New Issue