[clang] [Clang][diagnostics] Fix structured binding shadows template param loc (PR #129116)

Oliver Hunt via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 27 20:08:35 PST 2025


================
@@ -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 at +1 {{decomposition declarations are a C++17 extension}}
+  auto [T] = arr{}; // expected-error {{declaration of 'T' shadows template parameter}}
----------------
ojhunt wrote:

I think this test case would benefit from the new lines added in the initial issue report - the reported behavior is due to us choosing to report an error based on the wrong part of the declaration, and I don't believe that this test case is sufficient to highlight the problem (or more to the point catch a regression in the behavior)

https://github.com/llvm/llvm-project/pull/129116


More information about the cfe-commits mailing list