Open
Description
Consider the following code (which was based on a test I was writing for #651):
typedef int *T;
void bar(T x, T y) {
x = 1; // warning: incompatible integer to pointer conversion assigning to 'T' (aka 'int *') from 'int'
y = (T)1;
}
Before #690, 3C makes no changes to this code. After #690, 3C converts the code to:
typedef _Ptr<int> T;
void bar(int *x : itype(T), int *y : itype(T)) {
x = 1; // warning: incompatible integer to pointer conversion assigning to 'T' (aka 'int *') from 'int'
y = (T)1; // error: expression has unknown bounds, cast to ptr<T> expects source to have bounds
}
which has a compile error. checkedc#1169 does not fix the problem; apparently it is with the C-style cast from int
to T
(i.e., _Ptr<int>
), which is never a valid cast, not the assignment to y
. I guess when 3C sees the unsafe cast from int
to T
, it needs to either constrain T
to wild or expand T
to int *
, a bit like it does in the function parameters.