-
Notifications
You must be signed in to change notification settings - Fork 15.1k
[Clang][P1061] Fix template arguments in local classes #121225
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| // RUN: %clang_cc1 -fsyntax-only %s -verify | ||
| // expected-no-diagnostics | ||
|
|
||
| template <int i> | ||
| int g() { | ||
| return [] (auto) -> int { | ||
| struct L { | ||
| int m = i; | ||
| }; | ||
| return 0; | ||
| } (42); | ||
|
||
| } | ||
|
|
||
| int v = g<1>(); | ||
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 main point of
getTemplateInstantiationPatternis to figure out the instantiation pattern as the name suggests, it would be better to fix the problem within it.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 comments for that states
So the "pattern" as I read it, is not an instantiation itself but the template (or partial specialization). In the case of the field in
struct Lwe need the intermediate instantiated struct to get the instantiated field.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.
Yes, the pattern is the corpus of the template, the parts which needs to be have template parameters replaced in order to produce an instantiation.
I think what I said still stands.