public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/96068] New: Extra semicolon outside of a function should be allowed after c++11?
@ 2020-07-05 15:33 haoxintu at gmail dot com
  2020-07-06 10:48 ` [Bug c++/96068] " redi at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: haoxintu at gmail dot com @ 2020-07-05 15:33 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96068

            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=c++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=c++98 -pedantic-errors test.cc
test.cc:1:16: error: extra ';' [-Wpedantic]
    1 | void foo () { };
      |                ^

$g++ -c -std=c++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=c++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: 

https://bugs.llvm.org/show_bug.cgi?id=46288

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. 

Did I miss something? Thank you very much.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-05-09 16:19 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-05 15:33 [Bug c++/96068] New: Extra semicolon outside of a function should be allowed after c++11? haoxintu at gmail dot com
2020-07-06 10:48 ` [Bug c++/96068] " redi at gcc dot gnu.org
2020-07-06 15:02 ` redi at gcc dot gnu.org
2020-07-06 16:12 ` cvs-commit at gcc dot gnu.org
2020-07-06 16:13 ` redi at gcc dot gnu.org
2021-11-08 10:31 ` pinskia at gcc dot gnu.org
2021-12-07  5:13 ` pinskia at gcc dot gnu.org
2022-05-09 16:19 ` jakub at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).