This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/61089] Misleading error message regarding inability to convert pointers


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]