http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52321
--- Comment #2 from Ivan Godard <igodard at pacbell dot net> 2012-02-21 15:30:42 UTC --- Somewhere there's an attept to coerce a to b that sees the source is a class and the target is a class and tries to see if the source is derived from target. That check fails because source is undefined, and the failure propagates out as other possible casts are tried. If you save the reason for failure your "can't cast" message can look at the reason. The message could expand on other possible reasons too. Just a suggestion - that's how we did it in the Mary compilers, and gave a list of the plausible reasons for failure.