https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52321

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2018-12-17
     Ever confirmed|0                           |1

--- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Clang outputs an extra line saying the type is incomplete (which should
probably be a "note:" but nevermind):

53231.cc:5:17: error: static_cast from 'foo *' to 'bar *', which are not
related by inheritance, is not allowed
       bar* b = static_cast<bar*>(f);
                ^~~~~~~~~~~~~~~~~~~~
53231.cc:1:7: note: 'foo' is incomplete
class foo;
      ^
1 error generated.


When both types are incomplete it says that too:

88503.cc:6:16: error: static_cast from 'Parent *' to 'Derived *', which are not
related by inheritance, is not allowed
        return static_cast<Derived*>(p);
               ^~~~~~~~~~~~~~~~~~~~~~~~
88503.cc:2:7: note: 'Derived' is incomplete
class Derived;
      ^
88503.cc:1:7: note: 'Parent' is incomplete
class Parent;
      ^
1 error generated.

Reply via email to