From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 90E4D3858415; Mon, 5 Feb 2024 14:49:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 90E4D3858415 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1707144593; bh=OWqFrGjCcCMXl3VGNHchb4k9ckfXcua8/BZSuGK1t78=; h=From:To:Subject:Date:In-Reply-To:References:From; b=SmE6WxqzUqoXgZTpSVmBTiLldJ1qrY9sTEJPNpM6Te7KEmny+MbPfsTnxzoiufdGJ yjwpFQGmqQbopmX7SlN9/sF6mm8iVrmNMQazjg76mRfRQtEtStjra8Wfwa8DXF7tXC aZuAbJwDLMCFBiVuPGwYgoo+4kS4T0Ia14UQAqX4= From: "kab at acm dot org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/113760] gcc rejects valid empty-declaration in pedantic mode Date: Mon, 05 Feb 2024 14:49:53 +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: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: kab at acm dot org X-Bugzilla-Status: WAITING 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: cc 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=3D113760 kab at acm dot org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kab at acm dot org --- Comment #5 from kab at acm dot org --- (In reply to Andrew Pinski from comment #3) > From JDK bug report: > > It looks like it only removed > > the warnings for empty declarations at namespace scope. I couldn't find > > anything for other cases, including empty class member declarations. >=20 > Yes because the C++ defect report was only for `Spurious semicolons at > namespace scope should be allowed`. See > https://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#569 . >=20 >=20 > ``` > struct f > { > int t; ; > }; > ``` >=20 > Is not allowed by the C++ standard currently and is a GCC extension, maybe > it should have a seperate flag to control that but I am not 100% sure. It's C++14 that the openjdk currently cares about. C++14 added "empty-declaration" to the syntax for "member-declaration". C++14 9.2 [class.mem] https://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1693 The above "struct f" declaration warns with C++14 and -Wpedantic, but shouldn't. Tested with that struct as the only contents of "test.cpp" and this command line for g++13.2.0: g++ -c -Wpedantic -std=3Dc++14 -o test.o test.cpp=