[llvm-bugs] [Bug 52325] New: -Wshadow-uncaptured-local diagnostic is enabled by -Wshadow-all but not -Wshadow-uncaptured-local command line option

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Oct 26 22:53:44 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=52325

            Bug ID: 52325
           Summary: -Wshadow-uncaptured-local diagnostic is enabled by
                    -Wshadow-all but not -Wshadow-uncaptured-local command
                    line option
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: cpeterson at mozilla.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
                    neeilans at live.com, richard-llvm at metafoo.co.uk

Given the following test program:

```
void foo(int a) {
  ([&](int* a) {
    *a = 1;
  })(&a);
}

int main() {
    return 0;
}
```

Compiling the test program with `clang++ -std=c++17 -Wshadow-all test.cpp`
reports the following warning:

```
a.cpp:2:13: warning: declaration shadows a local variable
[-Wshadow-uncaptured-local]
  ([&](int* a) {
            ^
a.cpp:1:14: note: previous declaration is here
void foo(int a) {
             ^
1 warning generated.
```

But compiling the test program with `clang++ -std=c++17
-Wshadow-uncaptured-local test.cpp` compiles successfully and reports no
warnings.

See similar bug 43667 about the -Wshadow-field-in-constructor command line
option enabling the -Wshadow-field-in-constructor diagnostic.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20211027/aaf27c7d/attachment.html>


More information about the llvm-bugs mailing list