public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/67013] New: Compilation error for well-formed program with empty declaration in the global namespace
@ 2015-07-26  0:46 anders.granlund.0 at gmail dot com
  2015-07-26  1:17 ` [Bug c++/67013] " pinskia at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: anders.granlund.0 at gmail dot com @ 2015-07-26  0:46 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 67013
           Summary: Compilation error for well-formed program with empty
                    declaration in the global namespace
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: anders.granlund.0 at gmail dot com
  Target Milestone: ---

Consider the following program:

  int main() {};

It is well-formed, the extra semi colon is just an empty declaration after the
definition of main.

Compile it with the following command line:

  g++ prog.cc -std=c++14 -pedantic-errors

The following error message is then given:

  prog.cc:1:14: error: extra ';' [-Wpedantic]
  int main() {};
              ^

I expected to get no error messages since the program is well-formed. For
comparison Clang gives no error message.

I have tried it with gcc HEAD 6.0.0 201507 here:

  http://melpon.org/wandbox/permlink/gaOys1DxBYMnRWei


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

* [Bug c++/67013] Compilation error for well-formed program with empty declaration in the global namespace
  2015-07-26  0:46 [Bug c++/67013] New: Compilation error for well-formed program with empty declaration in the global namespace anders.granlund.0 at gmail dot com
@ 2015-07-26  1:17 ` pinskia at gcc dot gnu.org
  2015-07-26 12:36 ` anders.granlund.0 at gmail dot com
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2015-07-26  1:17 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Did this change between C++98 and C++14 because GCC has the following in its
source:
          /* A declaration consisting of a single semicolon is
             invalid.  Allow it unless we're being pedantic.  */


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

* [Bug c++/67013] Compilation error for well-formed program with empty declaration in the global namespace
  2015-07-26  0:46 [Bug c++/67013] New: Compilation error for well-formed program with empty declaration in the global namespace anders.granlund.0 at gmail dot com
  2015-07-26  1:17 ` [Bug c++/67013] " pinskia at gcc dot gnu.org
@ 2015-07-26 12:36 ` anders.granlund.0 at gmail dot com
  2015-07-26 20:31 ` redi at gcc dot gnu.org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: anders.granlund.0 at gmail dot com @ 2015-07-26 12:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Anders Granlund <anders.granlund.0 at gmail dot com> ---
That comment seems to be incorrect. The c++ standard has never forbidden empty
declarations at global namespace. I think we should get a warning instead of an
error.


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

* [Bug c++/67013] Compilation error for well-formed program with empty declaration in the global namespace
  2015-07-26  0:46 [Bug c++/67013] New: Compilation error for well-formed program with empty declaration in the global namespace anders.granlund.0 at gmail dot com
  2015-07-26  1:17 ` [Bug c++/67013] " pinskia at gcc dot gnu.org
  2015-07-26 12:36 ` anders.granlund.0 at gmail dot com
@ 2015-07-26 20:31 ` redi at gcc dot gnu.org
  2015-07-26 20:36 ` anders.granlund.0 at gmail dot com
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: redi at gcc dot gnu.org @ 2015-07-26 20:31 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-07-26
     Ever confirmed|0                           |1

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
It might have changed between the ARM and C++98, but I haven't checked.


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

* [Bug c++/67013] Compilation error for well-formed program with empty declaration in the global namespace
  2015-07-26  0:46 [Bug c++/67013] New: Compilation error for well-formed program with empty declaration in the global namespace anders.granlund.0 at gmail dot com
                   ` (2 preceding siblings ...)
  2015-07-26 20:31 ` redi at gcc dot gnu.org
@ 2015-07-26 20:36 ` anders.granlund.0 at gmail dot com
  2015-07-26 20:39 ` pinskia at gcc dot gnu.org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: anders.granlund.0 at gmail dot com @ 2015-07-26 20:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Anders Granlund <anders.granlund.0 at gmail dot com> ---
(In reply to Jonathan Wakely from comment #3)
> It might have changed between the ARM and C++98, but I haven't checked.

Is ARM a c++ standard before c++98?


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

* [Bug c++/67013] Compilation error for well-formed program with empty declaration in the global namespace
  2015-07-26  0:46 [Bug c++/67013] New: Compilation error for well-formed program with empty declaration in the global namespace anders.granlund.0 at gmail dot com
                   ` (3 preceding siblings ...)
  2015-07-26 20:36 ` anders.granlund.0 at gmail dot com
@ 2015-07-26 20:39 ` pinskia at gcc dot gnu.org
  2015-07-26 20:41 ` pinskia at gcc dot gnu.org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2015-07-26 20:39 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Anders Granlund from comment #4)
> Is ARM a c++ standard before c++98?

It is the C++ Annotate Reference Manual.  It was not exactly a standard but it
was what described C++ before the standard came around.


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

* [Bug c++/67013] Compilation error for well-formed program with empty declaration in the global namespace
  2015-07-26  0:46 [Bug c++/67013] New: Compilation error for well-formed program with empty declaration in the global namespace anders.granlund.0 at gmail dot com
                   ` (4 preceding siblings ...)
  2015-07-26 20:39 ` pinskia at gcc dot gnu.org
@ 2015-07-26 20:41 ` pinskia at gcc dot gnu.org
  2015-07-26 20:42 ` pinskia at gcc dot gnu.org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2015-07-26 20:41 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Related to bug 12479.


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

* [Bug c++/67013] Compilation error for well-formed program with empty declaration in the global namespace
  2015-07-26  0:46 [Bug c++/67013] New: Compilation error for well-formed program with empty declaration in the global namespace anders.granlund.0 at gmail dot com
                   ` (5 preceding siblings ...)
  2015-07-26 20:41 ` pinskia at gcc dot gnu.org
@ 2015-07-26 20:42 ` pinskia at gcc dot gnu.org
  2015-07-26 20:46 ` pinskia at gcc dot gnu.org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2015-07-26 20:42 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
To some extend this could be considered a regression if it is a true bug as
GCC's old parser did not error out about this.


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

* [Bug c++/67013] Compilation error for well-formed program with empty declaration in the global namespace
  2015-07-26  0:46 [Bug c++/67013] New: Compilation error for well-formed program with empty declaration in the global namespace anders.granlund.0 at gmail dot com
                   ` (6 preceding siblings ...)
  2015-07-26 20:42 ` pinskia at gcc dot gnu.org
@ 2015-07-26 20:46 ` pinskia at gcc dot gnu.org
  2015-07-26 20:46 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2015-07-26 20:46 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
https://gcc.gnu.org/ml/gcc-help/2008-01/msg00221.html


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

* [Bug c++/67013] Compilation error for well-formed program with empty declaration in the global namespace
  2015-07-26  0:46 [Bug c++/67013] New: Compilation error for well-formed program with empty declaration in the global namespace anders.granlund.0 at gmail dot com
                   ` (7 preceding siblings ...)
  2015-07-26 20:46 ` pinskia at gcc dot gnu.org
@ 2015-07-26 20:46 ` pinskia at gcc dot gnu.org
  2015-07-26 20:47 ` pinskia at gcc dot gnu.org
  2021-12-07  5:13 ` [Bug c++/67013] [DR569] " pinskia at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2015-07-26 20:46 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
https://gcc.gnu.org/ml/gcc-patches/2007-03/msg00970.html


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

* [Bug c++/67013] Compilation error for well-formed program with empty declaration in the global namespace
  2015-07-26  0:46 [Bug c++/67013] New: Compilation error for well-formed program with empty declaration in the global namespace anders.granlund.0 at gmail dot com
                   ` (8 preceding siblings ...)
  2015-07-26 20:46 ` pinskia at gcc dot gnu.org
@ 2015-07-26 20:47 ` pinskia at gcc dot gnu.org
  2021-12-07  5:13 ` [Bug c++/67013] [DR569] " pinskia at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2015-07-26 20:47 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
https://gcc.gnu.org/ml/gcc-patches/2007-03/msg01304.html


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

* [Bug c++/67013] [DR569] Compilation error for well-formed program with empty declaration in the global namespace
  2015-07-26  0:46 [Bug c++/67013] New: Compilation error for well-formed program with empty declaration in the global namespace anders.granlund.0 at gmail dot com
                   ` (9 preceding siblings ...)
  2015-07-26 20:47 ` pinskia at gcc dot gnu.org
@ 2021-12-07  5:13 ` pinskia at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-07  5:13 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |DUPLICATE

--- Comment #12 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Fixed in GCC 11+, even though this is an older bug report of the problem, PR
96068 already has the reference to the commit message and all so closing as a
dup of that bug.

*** This bug has been marked as a duplicate of bug 96068 ***

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

end of thread, other threads:[~2021-12-07  5:13 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-26  0:46 [Bug c++/67013] New: Compilation error for well-formed program with empty declaration in the global namespace anders.granlund.0 at gmail dot com
2015-07-26  1:17 ` [Bug c++/67013] " pinskia at gcc dot gnu.org
2015-07-26 12:36 ` anders.granlund.0 at gmail dot com
2015-07-26 20:31 ` redi at gcc dot gnu.org
2015-07-26 20:36 ` anders.granlund.0 at gmail dot com
2015-07-26 20:39 ` pinskia at gcc dot gnu.org
2015-07-26 20:41 ` pinskia at gcc dot gnu.org
2015-07-26 20:42 ` pinskia at gcc dot gnu.org
2015-07-26 20:46 ` pinskia at gcc dot gnu.org
2015-07-26 20:46 ` pinskia at gcc dot gnu.org
2015-07-26 20:47 ` pinskia at gcc dot gnu.org
2021-12-07  5:13 ` [Bug c++/67013] [DR569] " pinskia 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).