Skip to content

Attributes appertaining to inner classes of class template specializations are duplicated #138596

@katzdm

Description

@katzdm

Given the following:

template <class T>
struct X {
    struct [[deprecated]] Inner { };
    [[deprecated]] static void fn() { };
};

int main() {
  X<int>::Inner d;
  X<int>::fn();
}

(Godbolt link w/ AST)

Two duplicate DeprecatedAttr nodes are attached to the ClassTemplateSpecializationDecl corresponding to X<int>::Inner. This can be observed for attributes whose Attr.td entry has both Clone and MeaningfulToClassTemplateSpecialization equal to 1.

I believe that both sema::instantiateTemplateAttribute and sema::instantiateTemplateAttributeForDecl are being invoked for each attribute.

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:frontendLanguage frontend issues, e.g. anything involving "Sema"confirmedVerified by a second party

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions