[LLVMbugs] [Bug 16620] New: Provide fixit for deref/addressof in function arguments
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Sat Jul 13 11:34:57 PDT 2013
http://llvm.org/bugs/show_bug.cgi?id=16620
Bug ID: 16620
Summary: Provide fixit for deref/addressof in function
arguments
Product: clang
Version: unspecified
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: C++
Assignee: unassignedclangbugs at nondot.org
Reporter: dblaikie at gmail.com
CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
Classification: Unclassified
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();
^
--
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/20130713/acf3c6a4/attachment.html>
More information about the llvm-bugs
mailing list