[Bug c++/61089] Misleading error message regarding inability to convert pointers
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed May 7 10:17:00 GMT 2014
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61089
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |diagnostic
Status|UNCONFIRMED |NEW
Last reconfirmed| |2014-05-07
Ever confirmed|0 |1
Severity|normal |enhancement
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Reduced to remove the Boost dependency:
class base; // {};
class derived; // : public base {};
void func(base* p);
derived* get();
int main()
{
func(get());
}
d.cc: In function 'int main()':
d.cc:11:13: error: cannot convert 'derived*' to 'base*' for argument '1' to
'void func(base*)'
func(get());
^
For comparison, clang outputs:
d.cc:11:3: error: no matching function for call to 'func'
func(get());
^~~~
d.cc:5:6: note: candidate function not viable: cannot convert argument of
incomplete type 'derived *' to 'base *'
void func(base* p);
^
1 error generated.
More information about the Gcc-bugs
mailing list