<html>
<head>
<base href="https://llvm.org/bugs/" />
</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 --- - -Wpessimizing-move fixit introduces -Wvexing-parse"
href="https://llvm.org/bugs/show_bug.cgi?id=25642">25642</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>-Wpessimizing-move fixit introduces -Wvexing-parse
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>3.7
</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>Frontend
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>sugak@fb.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>For the following code -Wpessimizing-move, suggests a fixit to remove call to
std::move:
```
#include <utility>
struct C { };
void f() {
C c(std::move(C()));
}
1.cpp:4:7: warning: moving a temporary object prevents copy elision
[-Wpessimizing-move]
C c(std::move(C()));
^
1.cpp:4:7: note: remove std::move call here
C c(std::move(C()));
^~~~~~~~~~ ~
1 warning generated.
```
When the fixit is applied, that variable declaration becomes function
declaration, it changes semantics, and introduced -Wvexing-parse violation:
```
1.cpp:4:6: warning: parentheses were disambiguated as a function declaration
[-Wvexing-parse]
C c(C());
^~~~~
1.cpp:4:7: note: add a pair of parentheses to declare a variable
C c(C());
^
( )
1 warning generated.
```
This is not a big deal. But since clang-tidy automatically apply such fixits it
would be nice to avoid semantics changes.
clang version 3.8.0 (trunk 251726)
Target: x86_64-unknown-linux-gnu
Thread model: posix</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>