https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98814
Bug ID: 98814
Summary: Add fix-it hints for missing asterisk
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Keywords: diagnostic
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: antoshkka at gmail dot com
Target Milestone: ---
Iterators and pointers are quite common in C++ code but newbies tend to forget
to dereference them:
struct my_vector { void push_back(int); };
struct my_iterator { int operator*(); };
void sample(my_vector& vec, my_iterator it) {
vec.push_back(it);
}
A fix-it hint would be helpful for cases when no matching function found but
the argument has an operator*() that returns a matching type.
More examples via godbolt playground: https://godbolt.org/z/dsrqj8