llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: Amr Hesham (AmrDeveloper) <details> <summary>Changes</summary> Fix structured binding shadows template parameter location Fixes: #<!-- -->129060 --- Full diff: https://github.com/llvm/llvm-project/pull/129116.diff 2 Files Affected: - (modified) clang/lib/Sema/SemaDeclCXX.cpp (+1-2) - (modified) clang/test/CXX/temp/temp.res/temp.local/p6.cpp (+5) ``````````diff diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index 664d48ccbc382..a3a028b9485d6 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -883,8 +883,7 @@ Sema::ActOnDecompositionDeclarator(Scope *S, Declarator &D, // It's not permitted to shadow a template parameter name. if (Previous.isSingleResult() && Previous.getFoundDecl()->isTemplateParameter()) { - DiagnoseTemplateParameterShadow(D.getIdentifierLoc(), - Previous.getFoundDecl()); + DiagnoseTemplateParameterShadow(B.NameLoc, Previous.getFoundDecl()); Previous.clear(); } diff --git a/clang/test/CXX/temp/temp.res/temp.local/p6.cpp b/clang/test/CXX/temp/temp.res/temp.local/p6.cpp index 00bb35813c39a..e464bb5e7eaef 100644 --- a/clang/test/CXX/temp/temp.res/temp.local/p6.cpp +++ b/clang/test/CXX/temp/temp.res/temp.local/p6.cpp @@ -162,3 +162,8 @@ struct A { }; A<0>::B a; } + +template <typename T> void shadow9() { // expected-note{{template parameter is declared here}} + using arr = int[1]; // expected-warning@+1 {{decomposition declarations are a C++17 extension}} + auto [T] = arr{}; // expected-error {{declaration of 'T' shadows template parameter}} +} `````````` </details> https://github.com/llvm/llvm-project/pull/129116 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits