Repository navigation
Implement workaround for LLVM-46269 by ensuring that constrained destructor appears after the unconstrained one - #2630
Merged
Stephan T. Lavavej (StephanTLavavej) merged 2 commits intoApr 4, 2022
Conversation
Michael Schellenberger Costa (miscco)
approved these changes
Apr 1, 2022
Contributor
|
Thanks bunches for jumping on this so quickly. I've added this PR to my list of things to ensure are in the 16.11 backport. |
Casey Carter (CaseyCarter)
approved these changes
Apr 1, 2022
Stephan T. Lavavej (StephanTLavavej)
approved these changes
Apr 1, 2022
Comment on lines
+482
to
+483
| // To test the correct specialization of _Defaultabox, this type must not be default constructible. | ||
| non_trivially_destructible_input_iterator() = delete; |
There was a problem hiding this comment.
I'm surprised that this doesn't trigger compiler warnings about "this class has no constructors" (usually I'd expect to see an (int, int) constructor or something similar to avoid this), but no change requested as there are apparently no test-breaking warnings.
Member
|
I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed. |
Member
|
Thanks for improving our Clang support! 😻 🐞 🎉 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This implements workaround for LLVM-46269 ("Only first destructor is considered when constraints are used").
If the constrained (and defaulted) destructor comes first, clang-cl uses it unconditionally, even if its constraints are not satisfied. This leads to an error when the defaulted destructor is implicitly deleted (due to a non-trivially-destructible member).
By moving the constrained destructor after the unconstrained one (which is always valid, but is non-trivial), this patch sidesteps the abovementioned error.
This is suboptimal, because this makes the affected types never trivially destructible when compiled with clang-cl. A perfect fix would need to use something akin to the existing
_Optional_destruct_base, which I assume that we want to avoid.