<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 - Erroneous fix-it in for-range loop over values when given a collection of pointers"
href="https://bugs.llvm.org/show_bug.cgi?id=39502">39502</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Erroneous fix-it in for-range loop over values when given a collection of pointers
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</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>C++
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>jordan_rose@apple.com
</td>
</tr>
<tr>
<th>CC</th>
<td>dgregor@apple.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>// 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</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>