Skip to content

: add arithmetic overloads for std::lerp - #2113

Merged
Stephan T. Lavavej (StephanTLavavej) merged 14 commits into
microsoft:mainfrom
fsb4000:fix2112
May 5, 2022
Merged

Stephan T. Lavavej (StephanTLavavej) merged 14 commits into
microsoft:mainfrom
fsb4000:fix2112

Conversation

@fsb4000

@fsb4000 Igor Zhukov (fsb4000) commented Aug 11, 2021 •

Copy link
Copy Markdown
Contributor

Fixes #2112

Should I add remove_volatile or remove_cv for if constexpr conditions?

I think "No" but I am unsure.

@fsb4000
Igor Zhukov (fsb4000) requested a review from a team as a code owner August 11, 2021 18:14
@StephanTLavavej Stephan T. Lavavej (StephanTLavavej) added the bug Something isn't working label Aug 11, 2021

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not clear that this should be implemented

Comment thread stl/inc/cmath
@ghost

This comment was marked as outdated.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can remove this again if LWG-3223 gains traction, but for now we're just creating a portability landmine by diverging from libc++ and libstdc++ (https://godbolt.org/z/TrPs9zae5). I'm happy to implement this if we cleanup the comment on 1312.

Comment thread stl/inc/cmath Outdated
Comment thread stl/inc/cmath Outdated
* `` isn't needed
* simplify metaprogramming
@CaseyCarter

Copy link
Copy Markdown
Contributor

Should I add remove_volatile or remove_cv for if constexpr conditions?

I think "No" but I am unsure.

Not necessary. Top-level cv-qualifiers are stripped away by template argument deduction.

@fsb4000

Igor Zhukov (fsb4000) commented May 1, 2022 •

Copy link
Copy Markdown
Contributor Author

Not necessary. Top-level cv-qualifiers are stripped away by template argument deduction.

Yes, but a person could do a stupid thing like an explicit template instantiation, should we care about it?

https://gcc.godbolt.org/z/o89jraYbM

@CaseyCarter

Copy link
Copy Markdown
Contributor

Yes, but a person could do a stupid thing like an explicit template instantiation, should we care about it?

https://gcc.godbolt.org/z/o89jraYbM

The Standard doesn't necessarily even say there's a template here, let alone what the template parameters are and what they mean. This is "play stupid games, win stupid prizes"-level undefined behavior.

Comment thread stl/inc/cmath Outdated
Comment thread tests/std/tests/P0811R3_midpoint_lerp/test.cpp Outdated
Comment thread tests/std/tests/P0811R3_midpoint_lerp/test.cpp Outdated
@StephanTLavavej

Copy link
Copy Markdown
Member

⚠️ Note to self:

I must export this new overload of lerp().

@StephanTLavavej

Copy link
Copy Markdown
Member

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

@StephanTLavavej
Stephan T. Lavavej (StephanTLavavej) merged commit 39a0ea7 into microsoft:main May 5, 2022
@StephanTLavavej

Copy link
Copy Markdown
Member

Thanks for fixing this bug and improving portability! 🐞 ✅ 😸

@fsb4000
Igor Zhukov (fsb4000) deleted the fix2112 branch May 5, 2022 10:13
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.

: std::lerp is missing Arithmetic overloads

5 participants