From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 8216E3871036; Wed, 26 Jun 2024 16:33:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8216E3871036 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1719419620; bh=d6BhmATZTkfy7lzyiHdW+0T1Y0IRoiPb3HEVrNllu2U=; h=From:To:Subject:Date:In-Reply-To:References:From; b=inosUAN6SFb+IRUgjbPb+nskEUSplBmx1Dx/YtB9RSagSgJwceJFAZS0xDS981XRm 5cm9J3uWcGn8kkLX3Vd9pPS9hZvbptvxWOUkDIaqxbLUcKzZDPvJGpMowVgWs887HL 4X8z+SbYW+3vcSKbCjl7J4R+rdgBcZc7N5P86f88= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/115664] -Wnonnull-compare breaks templated methods Date: Wed, 26 Jun 2024 16:33:39 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 13.3.1 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_status Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D115664 Andrew Pinski changed: What |Removed |Added ---------------------------------------------------------------------------- Status|WAITING |NEW --- Comment #4 from Andrew Pinski --- Oh I take that back here is the testcase which shows the warning: ``` struct Object { template void method(void (*callback)(T*)); virtual void g(); }; template void Object::method(void (*)(T*)) { if (dynamic_cast(this) =3D=3D nullptr) throw 1; } void c(Object*); void f(Object *a) { a->method(c); } ``` I didn't read the original description correctly.=