This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/61449] New: Statement expressions disallow storage specifiers


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

            Bug ID: 61449
           Summary: Statement expressions disallow storage specifiers
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: cube2killfield at gmail dot com

Essentially we have a tool which preprocesses C code and produces these inline
statement expressions with prototypes like ({ void foo(void); &foo; }) and then
later implements the function. This is fine for global scope functions, but
ideally we want static storage on these functions as they're not suppose to
leak the file scope or be subject to automatic library import. The problem is
one cannot do the following with statement expressions.

({ static void foo(void); &foo; })
static void foo() { }

This is fairly inconsistent behavior in respect to what constitutes a valid
declaration. I'm surprised this issue hasn't been run into before. Storage
specifiers should be valid in statement expressions.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]