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

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-02-21 
15:53:10 UTC ---
Yep, it's build_static_cast_1 in typeck.c

But currently that has no way to store or pass back a message (just a boolean
indicating success or failure and the result of the cast) and would need a lot
of restructuring.

if (target is pointer or reference
    && source is class type
    && target is class type
    && (target is rvalue || source is lvalue)
    && target is derived from source
    && can convert
    && at least as qualified)

Your example fails the "target is derived from source" test, but that test
doesn't say it failed because the type is incomplete, it just returns false. 
And the "can convert" step might fail for a number of reasons, but again it
just returns a boolean.

Modifying that to report different reasons (rather than just evaluating to
'false') is not simple.

Reply via email to