Tweak invalid construction policy tests #466
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The "complex to real" test was based on some assumptions about how
std::complexworked which I had never verified. It turns out thatwhether or not we permit certain conversions, they may not even be
possible. For example: you can't actually construct a
std::complex<float>from astd::complex<int>, even though you can ofcourse construct a
floatfrom anint!Therefore, we delete all irrelevant aspects of the test case, and focus
it down to its core: that
std::complex<float>tofloatis forbidden.The "negative ratio, unsigned destination" test will begin to fail for
an unrelated reason, with our new and more carefully designed
construction policy.
uint8_thas a max value of 255, andint8_tamax value of 127. We will now prevent assigning the former to the
latter because the risk of overflow is too high. (The max
non-overflowing value is 127, which is smaller than our threshold of
2147.)
Here, the fix is to just use 16-bit integers.
Helps #349.