-
Notifications
You must be signed in to change notification settings - Fork 13.6k
CTAD: parameter pack assertion crash when synthesizing deduction guides for alias #90209
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
Comments
@llvm/issue-subscribers-c-20 Author: Haojian Wu (hokein)
Example:
|
@llvm/issue-subscribers-clang-frontend Author: Haojian Wu (hokein)
Example:
|
Confirmed, it looks like this bug is an addition since clang-18 release. Do you know which change introduced it? |
I think it is a new issue introduced by the recent changes I made to implement the alias CTAD feature as the crash occurs in that code path. |
Do you understand the underlying issues? Do you have plan to fix it? |
I haven't delved into it deeply yet, but I suspect we may have some issues with handling the parameter pack. I plan to address this before the next clang release. |
A more simplified test case:
The alias deduction guide synthesized from the written
When deducing the template arguments of the return type of the This seems working as intended, as clang loses this kind of information during the template argument deduction, see the FIXME. |
Ideally, addressing the FIXME should fix this issue. @mizvekov, how hard would it be to address it? If it is hard or requires significant work, I think we can use fix this crash by using the index and depth to retrieve the corresponding decl from the template parameter list of the alias. |
That FIXME is partially addressed in #93433, regarding the TemplateName. But I don't think we should depend on type sugar to be correct here, figuring out the correct parameter from depth and index alone is more consistent. |
…TemplateParamsReferencedInTemplateArgumentList (llvm#98013) As described in llvm#90209 (comment), Clang may not preserve enough information during template argument deduction. This can result in a merely canonical `TemplateTypeParmType` with a null `Decl`, leading to an incomplete template parameter list for the synthesized deduction guide. This patch addresses the issue by using the index and depth information to retrieve the corresponding template parameter, rather than relying on `TTP->getDecl()`. Fixes llvm#90209
Example:
https://godbolt.org/z/fssjafzYe.
The text was updated successfully, but these errors were encountered: