================ @@ -13464,6 +13464,14 @@ Decl *Sema::ActOnAliasDeclaration(Scope *S, AccessSpecifier AS, } TemplateParameterList *TemplateParams = TemplateParamLists[0]; + // Check shadowing of a template parameter name + for (NamedDecl *TP : TemplateParams->asArray()) { + if (NameInfo.getName() == TP->getDeclName()) { + DiagnoseTemplateParameterShadow(Name.StartLocation, TP); + return nullptr; + } + } + ---------------- BaLiKfromUA wrote:
Thank you for the review! I also was with this expectation and made some investigation (but be aware that it might not be 100% correct 😛). According to my debugging, the reason for `LookupName(Previous, S);` at line `13425` not seeing template params of alias template is logic on the beginning of a function (line `13401`): ``` S = S->getDeclParent(); ``` If you remove this line, the behavior mentioned in the issue is successfully diagnosed. Initially, I thought that this logic was important for some other template aliasing functionality that I was missing, but I run locally all clang tests without this line, and seems like it doesn't. So I am probably overthinking and we could just remove line `13401` instead of implementing this loop. @zyn0217 Let me know if I am missing something! Otherwise, I will send a fix without this loop later today. https://github.com/llvm/llvm-project/pull/123533 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits