-
-
Notifications
You must be signed in to change notification settings - Fork 606
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix issue #16976 - Do not convert blindly the size of an iterable. #6342
Conversation
|
{ | ||
if (!Type.tsize_t.implicitConvTo(fs.key.type)) | ||
{ | ||
fs.error("foreach: cannot implicitly convert the loop index from %s to %s", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it can break valid code, it needs to be a deprecation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, I did use error
because the implicit casts failing throw an error, but if you feel this should follow the deprecation path first I'll change it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we should never just break code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made it a deprecation
instead and added a test
More discussion here, I'm inclined to make this a |
D-runtime seems to rely on that behavior. |
Because sadly unsigned still implicitly converts to signed. |
The length parameter on 32bit is a uint not a ulong. |
If the VRP can determine that the index fits into the selected type no warning is issued. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
needs rebase, though
see #8941 |
Discuss, this might break some code relying on the implicit cast being done anyways.
Tests will follow suite once we come to an agreement.