[Clang][diagnostics] The location marking that structured binding shadows template parameter is not clear · Issue #129060 · llvm/llvm-project (original) (raw)
template void test1() { using arr = int[1]; auto [T] = arr{}; }
Current diagnostics:
:3:8: error: declaration of 'T' shadows template parameter 3 | auto [T] = arr{}; | ^ :1:20: note: template parameter is declared here 1 | template void test1() { | ^Expected diagnostics:
:3:9: error: declaration of 'T' shadows template parameter 3 | auto [T] = arr{}; | ^ :1:20: note: template parameter is declared here 1 | template void test1() { | ^It becomes more obvious if we add new line characters between '[' and ']':
template void test2() { using arr = int[1]; auto [ T ] = arr{}; }
Current diagnostics:
:8:8: error: declaration of 'T' shadows template parameter 8 | auto [ | ^ :6:20: note: template parameter is declared here 6 | template void test2() { | ^Expected diagnostics:
:9:5: error: declaration of 'T' shadows template parameter 9 | T | ^ :6:20: note: template parameter is declared here 6 | template void test2() { | ^Compiler Explorer: https://godbolt.org/z/oEPdWaabK
I believe this can be a good-first-issue.