avoid constraint recursion in __basic_any#8121
Open
ericniebler wants to merge 3 commits intoNVIDIA:mainfrom
Open
avoid constraint recursion in __basic_any#8121ericniebler wants to merge 3 commits intoNVIDIA:mainfrom
__basic_any#8121ericniebler wants to merge 3 commits intoNVIDIA:mainfrom
Conversation
Contributor
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
27b7d10 to
90e3973
Compare
95c89a1 to
2037216
Compare
Contributor
🥳 CI Workflow Results🟩 Finished in 1h 33m: Pass: 100%/99 | Total: 1d 11h | Max: 1h 15m | Hits: 93%/257836See results here. |
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.
Description
closes #8037
as described in #8037, it is too easy when using
any_resourceandresource_refto encounter mysterious compiler errors about recursive constraints. For example, the following code triggers the error:when asking if
derived_resourceis move-constructible, we check if there is aderived_resourceconstructor that accepts (an rvalue)derived_resource. there are two constructors that can take aderived_resourceas an argument: the compiler-generated move constructor (the one we wanted to be used), and the constructor that takes aresource_refbecausederived_resourceis-a resource.when checking if the
derived_resource(resource_ref)constructor is viable, we instantiate theresource_ref(T&)constructor withT=derived_resource1. that constructor checks, among other things, that the typeTis move-constructible, completing the cycle in the type system.the fix is to change
__basic_any, the guts ofresource_ref, to not constrain its constructor with checks for copyability or moveability. instead, we move those checks into the body of the constructor asstatic_asserts.Checklist
Footnotes
we shouldn't though because rvalues don't bind to lvalue references. i think that's a compiler bug. ↩