<html>
<head>
<base href="http://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 --- - Provide fixit for deref/addressof in function arguments"
href="http://llvm.org/bugs/show_bug.cgi?id=16620">16620</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Provide fixit for deref/addressof in function arguments
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</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>normal
</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>dblaikie@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>dgregor@apple.com, llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>For function arguments we suggest textually that the user may want to add a '*'
or '&' but don't provide a fixit hint. It's actually possible that we do have
fixits but since the note diagnostic is pointing to the function declaration,
the user will never see it (and -fixit only applies fixits on the error itself,
as far as I know).
Could we shorten these diagnostics by collapsing the note into the error &
providing the fixit on the error? (if there's only one function candidate -
potentially we could even do this if there are multiple fixits, collapsing them
all up onto the error itself) This may have tradeoffs with spell checking,
though - I'm not sure how advanced spellcheck has got to looking at candidates
with better argument type matches, but if we decide on a spelling (either the
one the user wrote, or one we chose) we could still suggest these fixits on the
candidate itself.
Also, for member functions that are not overloaded we don't even have the
textual suggestion of '*' or '&', which is unfortunate. The below diagnostics
show '*' and '&' examples for free functions, member functions and overloaded
member functions.
assign.cpp:18:3: error: no matching function for call to 'func'
func(a);
^~~~
assign.cpp:1:6: note: candidate function not viable: no known conversion from
'int *' to 'int' for 1st argument; dereference the argument with *
void func(int);
^
assign.cpp:19:3: error: no matching function for call to 'func2'
func2(c);
^~~~~
assign.cpp:2:6: note: candidate function not viable: no known conversion from
'int' to 'int *' for 1st argument; take the address of the argument with &
void func2(int*);
^
assign.cpp:21:10: error: cannot initialize a parameter of type 'int' with an
lvalue of type 'int *'
f.func(a);
^
assign.cpp:5:16: note: passing argument to parameter here
void func(int);
^
assign.cpp:22:11: error: cannot initialize a parameter of type 'int *' with an
lvalue of type 'int'
f.func2(c);
^
assign.cpp:6:18: note: passing argument to parameter here
void func2(int*);
^
assign.cpp:23:5: error: no matching member function for call to 'func3'
f.func3(a);
~~^~~~~
assign.cpp:7:8: note: candidate function not viable: no known conversion from
'int *' to 'int' for 1st argument; dereference the argument with *
void func3(int);
^
assign.cpp:8:8: note: candidate function not viable: requires 0 arguments, but
1 was provided
void func3();
^</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>