This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/61089] Misleading error message regarding inability to convert pointers
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 07 May 2014 10:16:58 +0000
- Subject: [Bug c++/61089] Misleading error message regarding inability to convert pointers
- Auto-submitted: auto-generated
- References: <bug-61089-4 at http dot gcc dot gnu dot org/bugzilla/>
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.