public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/39556]  New: statics in C99 inline functions later declared extern
@ 2009-03-25 20:04 jsm28 at gcc dot gnu dot org
  2009-03-30  1:10 ` [Bug c/39556] " jsm28 at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2009-03-25 20:04 UTC (permalink / raw)
  To: gcc-bugs

C99 prohibits an "inline definition" of a function with external linkage
from containing modifiable static variables or references to file-scope
static variables or functions.

A definition is an inline definition only if all file-scope declarations
for the function in the translation unit use "inline" and do not use
"extern".  Thus, this cannot be determined until the end of the translation
unit.  GCC gives the diagnostics for the above constraint too soon, leading
to the following valid examples being wrongly rejected with -std=c99
-pedantic-errors.  It needs to defer them and see at the end of the
translation unit whether the definition is an inline definition after all.

Example 1:
static int a;
inline int f (void) { return a; }
int f (void);

Example 2:
inline void f (void) { static int a; }
extern inline void f (void);


-- 
           Summary: statics in C99 inline functions later declared extern
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jsm28 at gcc dot gnu dot org
OtherBugsDependingO 16989
             nThis:


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39556


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

end of thread, other threads:[~2009-04-26 13:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-25 20:04 [Bug c/39556] New: statics in C99 inline functions later declared extern jsm28 at gcc dot gnu dot org
2009-03-30  1:10 ` [Bug c/39556] " jsm28 at gcc dot gnu dot org
2009-04-26 13:40 ` jsm28 at gcc dot gnu dot org
2009-04-26 13:42 ` jsm28 at gcc dot gnu dot 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).