You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Consider a conditional expression whose rvalue bounds depend on a variable that appears in only one arm:
array_ptr<int> y : count(5) = 0;
array_ptr<int> x : count(5) : cond ? y : 0;
The compiler infers bounds(y, y + 5) for the left arm, bounds(any) for the right arm, and bounds(y, y + 5) for the conditional expression cond ? y : 0. These bounds are used to validate the declared bounds bounds(x, x + 5) of x. Since it is not known that x and y are equivalent, this results in a compiler warning: "cannot prove declared bounds of 'x' are valid after initialization".
The logic outlined in the language spec for handling uses of temporaries bound in only one arm may be generalized to handle this case.
The text was updated successfully, but these errors were encountered:
Consider a conditional expression whose rvalue bounds depend on a variable that appears in only one arm:
The compiler infers
bounds(y, y + 5)
for the left arm,bounds(any)
for the right arm, andbounds(y, y + 5)
for the conditional expressioncond ? y : 0
. These bounds are used to validate the declared boundsbounds(x, x + 5)
ofx
. Since it is not known thatx
andy
are equivalent, this results in a compiler warning: "cannot prove declared bounds of 'x' are valid after initialization".The logic outlined in the language spec for handling uses of temporaries bound in only one arm may be generalized to handle this case.
The text was updated successfully, but these errors were encountered: