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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

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
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
Status: Ready To Merge
Development

Successfully merging this pull request may close these issues.

P0608R3 breaks flang build with Clang
3 participants