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

Short-circuit some variant constraints #4966

Merged
merged 2 commits into from
Sep 28, 2024

Conversation

CaseyCarter
Copy link
Member

variant's converting constructor and assignment operator templates are constrained to reject arguments of the variant's type. In such a case, the templates instantiated to check the constructibility constraint might be ill-formed outside the immediate context of template instantiation causing a hard error. We should split the constraints into multiple enable_if_ts to enable short-circuiting of later constraints when the earlier constraints fail.

Fixes #4959.

`variant`'s converting constructor and assignment operator templates are constrained to reject arguments of the `variant`'s type. In such a case, the templates instantiated to check the constructibility constraint might be ill-formed outside the immediate context of template instantiation causing a hard error. We should split the constraints into multiple `enable_if_t`s to enable short-circuiting of later constraints when the earlier constraints fail.

Fixes microsoft#4959.
@CaseyCarter CaseyCarter added the bug Something isn't working label Sep 19, 2024
@CaseyCarter CaseyCarter requested a review from a team as a code owner September 19, 2024 04:54
@StephanTLavavej StephanTLavavej self-assigned this Sep 19, 2024
stl/inc/variant Show resolved Hide resolved
tests/std/tests/P0088R3_variant_msvc/test.cpp Outdated Show resolved Hide resolved
tests/std/tests/P0088R3_variant_msvc/test.cpp Outdated Show resolved Hide resolved
@StephanTLavavej StephanTLavavej removed their assignment Sep 20, 2024
@StephanTLavavej StephanTLavavej self-assigned this Sep 20, 2024
@StephanTLavavej StephanTLavavej removed their assignment Sep 20, 2024
@StephanTLavavej StephanTLavavej self-assigned this Sep 27, 2024
@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 f8f9f7a into microsoft:main Sep 28, 2024
39 checks passed
@StephanTLavavej
Copy link
Member

⚡ 🤖 5️⃣

@CaseyCarter CaseyCarter deleted the variant-constraints branch September 29, 2024 06:40
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
Archived in project
Development

Successfully merging this pull request may close these issues.

P0608R3 breaks flang build with Clang
3 participants