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

--- Comment #12 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Ivan Godard from comment #4)
> Define an enum of reasons with "success" first, flop the sense of the test
> so that false means coercion was OK (grep to find all calls and put a "!" in
> front of each), and return the reason enum instead of bool. The code that is
> reason-aware saves the enum and builds a good message; the legacy code that
> is not reason-aware treats the enum as a bool and works as before except for
> the inverted sense of the test. Maybe half an hour of work.

A much simpler "good enough" solution is to just leave build_static_cast_1
alone. In the caller, if the cast fails and one or both types is a
pointer/reference to incomplete class, issue a note. It doesn't matter if the
reason it failed is the incomplete type, because I don't try to say that, I
just say it's incomplete.

Reply via email to