[clang] [Sema] Propagate preferred_name attribute to existing specializations (PR #186741)
Younan Zhang via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 20 03:30:51 PDT 2026
================
@@ -1222,7 +1221,19 @@ static void handlePreferredName(Sema &S, Decl *D, const ParsedAttr &AL) {
}
if (Template && declaresSameEntity(Template, CTD)) {
- D->addAttr(::new (S.Context) PreferredNameAttr(S.Context, AL, TSI));
+ auto *PNA = ::new (S.Context) PreferredNameAttr(S.Context, AL, TSI);
+ D->addAttr(PNA);
+
+ for (auto *Spec : CTD->specializations()) {
+ const TypeDecl *TD = static_cast<const TypeDecl *>(Spec);
+ if (S.Context.hasSameType(S.Context.getTypeDeclType(TD),
----------------
zyn0217 wrote:
What makes it necessary to check the same type here?
https://github.com/llvm/llvm-project/pull/186741
More information about the cfe-commits
mailing list