public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/66995] New: First declaration as inline after definition of function
@ 2015-07-24 14:12 anders.granlund.0 at gmail dot com
  2015-07-24 15:25 ` [Bug c++/66995] " redi at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: anders.granlund.0 at gmail dot com @ 2015-07-24 14:12 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 66995
           Summary: First declaration as inline after definition of
                    function
           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 (prog.cc):

  void f() {}
  inline void f();
  int main() {}

It is ill-formed by [dcl.fct.spec]/4 (http://eel.is/c++draft/dcl.fct.spec#4):

"If the definition of a function appears in a translation unit before its first
declaration as inline, the program is ill-formed."

Therefore I expected gcc to give at least one diagnostic message when compiling
it, but I get none with the following command line:

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

I have tried with gcc HEAD 6.0.0 20150722 here:

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


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

* [Bug c++/66995] First declaration as inline after definition of function
  2015-07-24 14:12 [Bug c++/66995] New: First declaration as inline after definition of function anders.granlund.0 at gmail dot com
@ 2015-07-24 15:25 ` redi at gcc dot gnu.org
  2021-08-27  0:49 ` [Bug c++/66995] [DR317] " pinskia at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2015-07-24 15:25 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |accepts-invalid
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-07-24
     Ever confirmed|0                           |1


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

* [Bug c++/66995] [DR317] First declaration as inline after definition of function
  2015-07-24 14:12 [Bug c++/66995] New: First declaration as inline after definition of function anders.granlund.0 at gmail dot com
  2015-07-24 15:25 ` [Bug c++/66995] " redi at gcc dot gnu.org
@ 2021-08-27  0:49 ` pinskia at gcc dot gnu.org
  2022-08-24 11:52 ` redi at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-27  0:49 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Blocks|                            |94404
            Summary|First declaration as inline |[DR317] First declaration
                   |after definition of         |as inline after definition
                   |function                    |of function

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
So this is DR317.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94404
[Bug 94404] [meta-bug] C++ core issues

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

* [Bug c++/66995] [DR317] First declaration as inline after definition of function
  2015-07-24 14:12 [Bug c++/66995] New: First declaration as inline after definition of function anders.granlund.0 at gmail dot com
  2015-07-24 15:25 ` [Bug c++/66995] " redi at gcc dot gnu.org
  2021-08-27  0:49 ` [Bug c++/66995] [DR317] " pinskia at gcc dot gnu.org
@ 2022-08-24 11:52 ` redi at gcc dot gnu.org
  2022-08-24 11:52 ` redi at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2022-08-24 11:52 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #1)
> So this is DR317.

And the new rule first appeared in C++11.

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

* [Bug c++/66995] [DR317] First declaration as inline after definition of function
  2015-07-24 14:12 [Bug c++/66995] New: First declaration as inline after definition of function anders.granlund.0 at gmail dot com
                   ` (2 preceding siblings ...)
  2022-08-24 11:52 ` redi at gcc dot gnu.org
@ 2022-08-24 11:52 ` redi at gcc dot gnu.org
  2022-08-24 11:54 ` redi at gcc dot gnu.org
  2022-08-24 12:46 ` whh8b at obs dot cr
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2022-08-24 11:52 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |whh8b at obs dot cr

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
*** Bug 106729 has been marked as a duplicate of this bug. ***

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

* [Bug c++/66995] [DR317] First declaration as inline after definition of function
  2015-07-24 14:12 [Bug c++/66995] New: First declaration as inline after definition of function anders.granlund.0 at gmail dot com
                   ` (3 preceding siblings ...)
  2022-08-24 11:52 ` redi at gcc dot gnu.org
@ 2022-08-24 11:54 ` redi at gcc dot gnu.org
  2022-08-24 12:46 ` whh8b at obs dot cr
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2022-08-24 11:54 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2021-08-04 00:00:00         |2022-8-24

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Clang rejects this:

in.C:2:13: error: inline declaration of 'f' follows non-inline definition
inline void f();
            ^
in.C:1:6: note: previous definition is here
void f() {}
     ^
1 error generated.

EDG accepts it by default, but rejects it with --strict:

"in.C", line 2: error: function "f" cannot be declared inline after its
          definition at line 1
  inline void f();
              ^

1 error detected in the compilation of "in.C".

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

* [Bug c++/66995] [DR317] First declaration as inline after definition of function
  2015-07-24 14:12 [Bug c++/66995] New: First declaration as inline after definition of function anders.granlund.0 at gmail dot com
                   ` (4 preceding siblings ...)
  2022-08-24 11:54 ` redi at gcc dot gnu.org
@ 2022-08-24 12:46 ` whh8b at obs dot cr
  5 siblings, 0 replies; 7+ messages in thread
From: whh8b at obs dot cr @ 2022-08-24 12:46 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Will Hawkins <whh8b at obs dot cr> ---
Not sure that I will have any success, but I'd like to give fixing this issue a
try. I will keep you posted.

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

end of thread, other threads:[~2022-08-24 12:46 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-24 14:12 [Bug c++/66995] New: First declaration as inline after definition of function anders.granlund.0 at gmail dot com
2015-07-24 15:25 ` [Bug c++/66995] " redi at gcc dot gnu.org
2021-08-27  0:49 ` [Bug c++/66995] [DR317] " pinskia at gcc dot gnu.org
2022-08-24 11:52 ` redi at gcc dot gnu.org
2022-08-24 11:52 ` redi at gcc dot gnu.org
2022-08-24 11:54 ` redi at gcc dot gnu.org
2022-08-24 12:46 ` whh8b at obs dot cr

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).