-
Notifications
You must be signed in to change notification settings - Fork 23
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
Add MSVC coverage for remaining suspicious asserts #365
Conversation
I thought the earlier test case would fail, but it didn't!
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.
The change seems fine. I'm not sure I understand the original issue. The error that I see is
failure was caused by a read of a variable outside its lifetime
But I don't see how that is possible 😕
With the changes to single-file-test.cc, I see the issue in godbolt. So the coverage seems better.
As an aside, can we get constants in the single file deployment? 😄 It doesn't seem to have SPEED_OF_LIGHT
.
I found this super confusing as well. The key is that "outside" in this case probably means "before". It's running "at compile time", but we're using the value of a variable that won't exist until runtime. At least, that's the nearest I can figure.
Those single-file releases are barebones. Check out the "Pre-built files with all units" box from the single file section of the install instructions. They should all be there! And, they're also in our canonical godbolt link from the |
Interesting. Is this an "issue" with MSVC? We're using it at compile time, but are we using any information that isn't available at compile time? |
Possibly! But I think we'd need to go deep into "language lawyer" territory to definitively say who is right. 😅 |
I went through every
static_assert
in our C++ files, and added MSVCtest coverage for any that looked like they might be vulnerable to the
same error as in #363.
I added these test cases one at a time, so I could tell which ones
failed.
The
is_known_to_be_less_than_one
"bug" never actually failed,whether I called it directly or indirectly. I'm leaving the tests in
place, and I "fixed" it anyway because it made the function body more
stylistically consistent.
The
inverse_as
/inverse_in
bug was indeed another instance of thisproblem. Now we have coverage and a fix.
Fixes #364.