https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61990
Bug ID: 61990
Summary: Incorrect caret location for type mismatches in
function calls
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: dmalcolm at redhat dot com
Given the following test.cc:
-------------------------------------------------------
class foo {};
class bar {};
extern void some_fn (foo *, foo *, bar *, foo *, foo *);
void test(foo *f)
{
some_fn (f, f, f, f, f);
}
-------------------------------------------------------
GCC trunk as of 2014-05-29 r211061 reports:
/tmp/test.cc:9:25: error: cannot convert ‘foo*’ to ‘bar*’ for argument ‘3’ to
‘void some_fn(foo*, foo*, bar*, foo*, foo*)’
some_fn (f, f, f, f, f);
^
It manages to report the arg num, but the caret is in the wrong place, on the
end paren; the caret should indicate the location of the bogus arg instead:
some_fn (f, f, f, f, f);
^
(Ideally, the whole of the bogus subexpression should be underlined, though I
appreciate that's a more involved fix architecturally).