[llvm-bugs] [Bug 39502] New: Erroneous fix-it in for-range loop over values when given a collection of pointers
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Oct 30 11:52:50 PDT 2018
https://bugs.llvm.org/show_bug.cgi?id=39502
Bug ID: 39502
Summary: Erroneous fix-it in for-range loop over values when
given a collection of pointers
Product: clang
Version: unspecified
Hardware: All
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: C++
Assignee: unassignedclangbugs at nondot.org
Reporter: jordan_rose at apple.com
CC: dgregor at apple.com, llvm-bugs at lists.llvm.org,
richard-llvm at metafoo.co.uk
// RUN: clang++ -std=c++11 -fsyntax-only -fdiagnostics-parseable-fixits
#include <vector>
struct Foo {};
void test(std::vector<Foo *> &v) {
for (Foo x : v)
;
}
---
% clang++ -std=c++11 -fsyntax-only -fdiagnostics-parseable-fixits test.cpp
test.cpp:4:12: error: no viable conversion from 'Foo *' to 'Foo'
for (Foo x : v)
^ ~
test.cpp:2:8: note: candidate constructor (the implicit copy constructor) not
viable: no known conversion from 'Foo *' to 'const Foo &' for 1st
argument; dereference the argument with *
struct Foo {};
^
fix-it:"test.cpp":{4:14-4:14}:"*"
test.cpp:2:8: note: candidate constructor (the implicit move constructor) not
viable: no known conversion from 'Foo *' to 'Foo &&' for 1st argument
struct Foo {};
^
---
Bad: inserting a fix-it before the ":" (current behavior)
Good: no fix-it, no custom message
Better: new message with a fix-it to turn the element type declaration into a
pointer when possible
--
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/20181030/6b8cc694/attachment.html>
More information about the llvm-bugs
mailing list