<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-field-in-constructor warning is not enabled by corresponding command line option"
href="https://bugs.llvm.org/show_bug.cgi?id=43667">43667</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Wshadow-field-in-constructor warning is not enabled by corresponding 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>Macintosh
</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>Frontend
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>llvm@mrks.info
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=22668" name="attach_22668" title="test case">attachment 22668</a> <a href="attachment.cgi?id=22668&action=edit" title="test case">[details]</a></span>
test case
The attached test case should produce a warning saying that the `v` constructor
argument shadows the `v` class member. With -Wshadow-all, this happens as
expected:
<source>:5:24: error: constructor parameter 'v' shadows the field 'v' of
'S' [-Werror,-Wshadow-field-in-constructor]
S(std::vector<int> v) : v(std::move(v)) {
^
<source>:8:22: note: previous declaration is here
std::vector<int> v;
^
However, the warning / error is described to be coming from
-Wshadow-field-in-constructor. Accordingly, I would expect that flag alone to
be sufficient to turn on the warning. However, when replacing -Wshadow-all with
that flag, no warning is emitted.
Compiler Explorer: <a href="https://godbolt.org/z/8cN1-W">https://godbolt.org/z/8cN1-W</a></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>