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.