[Bug c++/52321] poor diagnostic of invalid cast

igodard at pacbell dot net gcc-bugzilla@gcc.gnu.org
Tue Feb 21 15:38:00 GMT 2012


--- 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.

More information about the Gcc-bugs mailing list