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

Don't move from contained value of optional<const T> #2460

Merged
merged 3 commits into from
Mar 4, 2022

Conversation

CaseyCarter
Copy link
Member

...unless T supports it, of course.

Fixes #2458
Fixes DevCom-1628644 / VSO-1458298 / AB#1458298

...unless `T` supports it, of course.

Fixes microsoft#2458
Fixes DevCom-1628644 / VSO-1458298 / AB#1458298
@CaseyCarter CaseyCarter added the bug Something isn't working label Jan 6, 2022
@CaseyCarter CaseyCarter requested a review from a team as a code owner January 6, 2022 19:30
Copy link
Contributor

@fsb4000 fsb4000 left a comment

Choose a reason for hiding this comment

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

Note to self: that issue was because _Value defined as remove_const_t<_Ty> _Value;
So we always could move _Value. and now with operator* we are taking into account the const of _Ty.

@StephanTLavavej

This comment was marked as resolved.

@barcharcraz barcharcraz removed their assignment Mar 4, 2022
@StephanTLavavej StephanTLavavej self-assigned this Mar 4, 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 merged commit 598cdfa into microsoft:main Mar 4, 2022
@CaseyCarter CaseyCarter deleted the optional_const branch March 4, 2022 22:23
@StephanTLavavej
Copy link
Member

Thanks for fixing this moving bug! 🐛 🐞 😸

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.

<optional>: std::optional move constructor moves a const object
5 participants