<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - -Wshadow-uncaptured-local diagnostic is enabled by -Wshadow-all but not -Wshadow-uncaptured-local command line option"
href="https://bugs.llvm.org/show_bug.cgi?id=52325">52325</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>-Wshadow-uncaptured-local diagnostic is enabled by -Wshadow-all but not -Wshadow-uncaptured-local command line option
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>-New Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>cpeterson@mozilla.com
</td>
</tr>
<tr>
<th>CC</th>
<td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>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 <a class="bz_bug_link
bz_status_NEW "
title="NEW - Wshadow-field-in-constructor warning is not enabled by corresponding command line option"
href="show_bug.cgi?id=43667">bug 43667</a> about the -Wshadow-field-in-constructor command line
option enabling the -Wshadow-field-in-constructor diagnostic.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>