[llvm-bugs] [Bug 25642] New: -Wpessimizing-move fixit introduces -Wvexing-parse
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Nov 25 13:24:55 PST 2015
https://llvm.org/bugs/show_bug.cgi?id=25642
Bug ID: 25642
Summary: -Wpessimizing-move fixit introduces -Wvexing-parse
Product: clang
Version: 3.7
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: Frontend
Assignee: unassignedclangbugs at nondot.org
Reporter: sugak at fb.com
CC: llvm-bugs at lists.llvm.org
Classification: Unclassified
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
--
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/20151125/5b75df24/attachment.html>
More information about the llvm-bugs
mailing list