From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 773DA38582BC; Fri, 7 Oct 2022 03:22:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 773DA38582BC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1665112951; bh=pdPwSF53Ezyclromy5g9139zC/+I8CA+J/7V2JmtVus=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Df/1vyZCkD2TYtYftrOXJJzwuFiNGDvYN6SLVF3gLQXWLjFMFqJqHiK5SgOLExlvC /UCaCKXnKLYGRa1+8bn74WB1bLQzc9IatPr4aM1cm5SrZHHDmU+rZkUrwRkkUYriZ8 ow282Vbst9ztf1J9GaGu0cP98OD3gP+lUpCjGHtk= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/107178] Diagnosis for colon vs semi-colon in a member function declaration Date: Fri, 07 Oct 2022 03:22:13 +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: 12.2.1 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: enhancement X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED 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: keywords bug_severity 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=3D107178 Andrew Pinski changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |diagnostic Severity|normal |enhancement --- Comment #1 from Andrew Pinski --- clang diagnostic is way worse in my mind. It does not even point to the : . GCC is assuming if you don't have a constructor you have a type and that ty= pe here would be T (S::)() Take: ``` struct S { int (*foo)() :=20 int t; }; ``` Trying to define a pointer to function field foo but used : instead of ;. GCC diagonstic seems reasonable. because GCC assumes you started to define a bitfield which is reasonable assumention really. clang diagnostic here is never even close to helpful. At least GCC points out the colon and even suggest you started a bitfield w= hich is what a colon normally does here ....=