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: unassignedclangb...@nondot.org
          Reporter: cpeter...@mozilla.com
                CC: htmldevelo...@gmail.com, llvm-bugs@lists.llvm.org,
                    neeil...@live.com, richard-l...@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to