Skip to content
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

Suppress narrowing warnings in piecewise_constant_distribution::densities #3107

Merged
merged 2 commits into from
Sep 22, 2022

Conversation

CaseyCarter
Copy link
Contributor

This function converts a vector of double to a vector of _Ty, which is a narrowing conversion when Ty is float. It's silly to warn about this when the Standard makes it clear that the narrowing will occur, and the user has asked for such explicitly by calling piecewise_constant_distrubution<float>::densities.

Fixes #3105.

@CaseyCarter CaseyCarter added the bug Something isn't working label Sep 15, 2022
@CaseyCarter CaseyCarter requested a review from a team as a code owner September 15, 2022 21:38
@strega-nil-ms
Copy link
Contributor

This didn't actually suppress the warnings...

@CaseyCarter
Copy link
Contributor Author

This didn't actually suppress the warnings...

TFWU commit the tests but not the bugfix. 🤦

…ties

This function converts a `vector` of `double` to a `vector` of `_Ty`, which is a narrowing conversion when `Ty` is `float`. It's silly to warn about this when the Standard makes it clear that the narrowing will occur, and the user has asked for such explicitly by calling `piecewise_constant_distrubution<float>::densities`.

Fixes microsoft#3105.
@CaseyCarter
Copy link
Contributor Author

CaseyCarter commented Sep 15, 2022

I'll rebase onto the updated main and revalidate before pushing, it will be a minute.

@CaseyCarter CaseyCarter self-assigned this Sep 15, 2022
@CaseyCarter CaseyCarter removed their assignment Sep 15, 2022
@StephanTLavavej
Copy link
Member

@CaseyCarter @strega-nil-ms I have doubled the size of this PR 😹 🛠️ and converted the test to compile-only.

✅ No modules impact - the push-disable-pops are outside the member functions which is good.

@StephanTLavavej StephanTLavavej self-assigned this Sep 22, 2022
@StephanTLavavej
Copy link
Member

I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed.

@StephanTLavavej StephanTLavavej changed the title Suppress narrowing warnings in piecewise_constant_distrubution::densities Suppress narrowing warnings in piecewise_constant_distribution::densities Sep 22, 2022
@StephanTLavavej StephanTLavavej merged commit 57e603e into microsoft:main Sep 22, 2022
@StephanTLavavej
Copy link
Member

Thanks for investigating and fixing these spurious warnings! ⚠️ 😸 🎉

CaseyCarter added a commit to CaseyCarter/STL that referenced this pull request Oct 6, 2022
@CaseyCarter CaseyCarter deleted the part-foolish branch August 20, 2024 20:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

<random>: std::piecewise_constant_distribution<float>::densities() gives warning C4244
3 participants