-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[Clang][Sema] Revise the transformation of CTAD parameters of nested class templates #91628
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have the same pattern on Line 2438-2452 in this file, where we perform a substitution of
OuterInstantiationArgs
on a new transformed parameter decl, I think we should probably fix it as well.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that's just fine, although it looks weird: those lines are merely "creating" new template parameters rather than doing type substitution. (it's applying a
TemplateDeclInstantiator
with the instantiating arguments - the only valuable part from these arguments is the depth we're supposed to deduct, and the type isn't something we're concerned about at that time.)Frankly, I have to say I didn't fully understand why we have such discrepancies (use the
transformTemplateParameter
first and then aTemplateDeclInstantiator
for nested cases). I was expecting that perhaps we could unify them in one call. I think it warrants a separate refactoring PR, then.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
TemplateDeclInstantiator
is used for that substitution to avoid evaluating constraints at that point. Without this, the constraint template argument depths onNewParam
would be as if the parameter were at depth 0 (instead of the nested template depth), causing a crash when evaluated later.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@antangelo : thanks for the explanation. I was considering if we can reuse the
transformTemplateTypeParam
stuff instead of aTemplateDeclInstantiator
(we can make the constraint evaluation opt-in in that function; I presumed this would behave like whatsetEvaluateConstraints(false)
does.), but doing that doesn't look like it would simplify the logic here significantly, so I hesitated to do so.The other part
Depth1Args
also prevents us from combining these substitution into one call - I think I have to go through it further. Anyhow, this shouldn't block a backport.