<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/138596>138596</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Attributes appertaining to inner classes of class template specializations are duplicated
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
katzdm
</td>
</tr>
</table>
<pre>
Given the following:
```cpp
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](https://godbolt.org/z/PTafvec6q))
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.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyMVMGO2zgM_RrlQjRQ5NhJDj54JuuihwUWaA690hITa0eRXInOoPP1C9nOZFrsLgoIiGKR7z09ksKU7MUT1aJ8EuVxhSP3IdYvyG_muuqC-VF_tjfywD3BOTgXXq2_iKIRclqVnJceBiEbpuvgkAlE8awdpgQnUfwhZJM4jprhG4jdk5ANAMDyaeJ9MjRE0shkRHkU5RG-eE8xR4PYHUVxT_qP6MTIVsMtWANnL9ReqMPPyY-NbKxnuKL9EDehfxPFs_WcBReNKJpZglnIfz290zzgP7ixmKP2onz6HEwXHIOz_gVehWqh-XrKutW-Zx5ShlOtUO1lDlyHeBGqfROq_euE5xvp6nvmUYcZ9fQawIyDs3oyupLHdzca5igqCT4YSoCRAJlR92SAw1RBUcnnXJfTUqivA2mLzr4h2-CPpF3O1yFGSkPwxvpLThWV_Fd3RCXXcOptAo0eOoLQJYo3MnAOMZNH241MCV77kCb2LHHNJrOQ5_gDekzQBe5nacFTPkJv8v8_Cb31l_PoTuF_ZE9g30d0i9RNljWb9QU6cpZuBNwjvxMluuJ8DesTo2eLTHfw5i77g5LfS2hDvFuYze8o22f9LbwsjhDq_mHLemXqwhyKA66o3uy21Xa_KUu56msqi73eV3jeIR12B70zW0WS9nju9LaQemVrJVUpS1mqzbYs5XpXGJK0QZSIBisSW0lXtG7t3O2aW2plUxqp3hT78lCtHHbk0jT0Snl6helUKJXfgFjnpE_deEliK51NnB4wbNlR3TxKi8NAkdH6pVfsNDbT9FOCcJ638P40pJ9qN7fpez-b1Rhd_ctcWO7Hbq3DVag261h-Pg0x_E2ahWon9UmodrnerVb_BAAA__8gjooy">