From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21849 invoked by alias); 22 Feb 2012 15:59:52 -0000 Received: (qmail 21837 invoked by uid 22791); 22 Feb 2012 15:59:50 -0000 X-SWARE-Spam-Status: No, hits=-2.9 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 22 Feb 2012 15:58:32 +0000 From: "manu at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/52321] poor diagnostic of invalid cast Date: Wed, 22 Feb 2012 16:15:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: enhancement X-Bugzilla-Who: manu at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: CC Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-02/txt/msg02232.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D52321 Manuel L=C3=B3pez-Ib=C3=A1=C3=B1ez changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |manu at gcc dot gnu.org --- Comment #5 from Manuel L=C3=B3pez-Ib=C3=A1=C3=B1ez 2012-02-22 15:58:26 UTC --- (In reply to comment #4) > Define an enum of reasons with "success" first, flop the sense of the tes= t 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 th= at 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. >=20 > Plausible? Plausible in theory, sadly unrealistic in practice. But I would like to be proven wrong, so give it a try.