From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 25DEA3858D38; Sun, 5 Jul 2020 15:33:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 25DEA3858D38 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1593963233; bh=fRMQEJQepRb7OiMbE7KRuky2aMO34nELG/XeNcctFEM=; h=From:To:Subject:Date:From; b=Gz0A3JptaK2/9/JEjmKeepuyNzpBICKls5GFTd2zFwgUXJZGL8+QPIPI06keUYoSa 5gjVcWuj/cpcdOULn28h1Zfwsp8bIFTh8OU2YU0Z1S4RwdoeVja07NHWsSGtLmIp83 YT8U/lycJklTmHa5SKRBtu/1HfY2Smh5uxXhaKvw= From: "haoxintu at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/96068] New: Extra semicolon outside of a function should be allowed after c++11? Date: Sun, 05 Jul 2020 15:33:52 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: haoxintu at gmail dot com 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: bug_id short_desc product version bug_status keywords bug_severity priority component assigned_to reporter target_milestone Message-ID: 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Jul 2020 15:33:53 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D96068 Bug ID: 96068 Summary: Extra semicolon outside of a function should be allowed after c++11? Product: gcc Version: 11.0 Status: UNCONFIRMED Keywords: diagnostic Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: haoxintu at gmail dot com Target Milestone: --- Hi, all. As the summary, extra ";" should be allowed in GCC after -std=3Dc++11 and shouldn't give a diagnostic message about it? I know this is forbidden in c++98. For example, $cat test.cc void foo() { }; $g++ -c -std=3Dc++98 -pedantic-errors test.cc test.cc:1:16: error: extra ';' [-Wpedantic] 1 | void foo () { }; | ^ $g++ -c -std=3Dc++11 -pedantic-errors test.cc test.cc:1:16: error: extra ';' [-Wpedantic] 1 | void foo () { }; | ^ While in Clang, this is accepted in c++11 or later. $clang++ -c -std=3Dc++98 -pedantic-errors test.cc test.cc:1:15: error: extra ';' outside of a function is a C++11 extension [-Werror,-Wc++11-extra-semi] void foo() { }; ^ 1 error generated. There is also a related bug report in llvm:=20 https://bugs.llvm.org/show_bug.cgi?id=3D46288 They suggested that "If GCC rejects this under -pedantic-errors in C++11 or later, I think that's a GCC bug." I try to find a similar bug report in GCC but failed.=20 Did I miss something? Thank you very much.=