Skip to content

improve the AST for the synthesized deduction guide #79798

@hokein

Description

@hokein

Given the following CTAD code:

template <typename T>
struct C {
    template <typename U>
    C(U);
};
C c(1);

The synthesized deduction guide from the constructor is:

|-FunctionTemplateDecl  implicit <deduction guide for C>
| |-TemplateTypeParmDecl <line:1:11, col:20> col:20 typename depth 0 index 0 T
| |-TemplateTypeParmDecl <line:3:15, col:24> col:24 typename depth 0 index 1 U
| `-CXXDeductionGuideDecl <line:4:5, col:8> col:5 implicit <deduction guide for C> 'auto (type-parameter-0-1) -> C<T>'
|   `-ParmVarDecl 0x555d18fe4638 <col:7> col:8 'type-parameter-0-1'

Note that the function parameter type is canonicalized to type-parameter-0-1, this is suboptimal. I think it is better to show a normal U.

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:frontendLanguage frontend issues, e.g. anything involving "Sema"

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions