[Bug c++/17854] New: Accept statement expressions at top level

rth at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Tue Oct 5 22:55:00 GMT 2004


The primary motivation for allowing this is to handle macros provided by
system headers.  For instance, the htonl macro from <netinet/in.h> in glibc
uses statement expressions, but from the user's point of view it looks like
a function call.  Admittedly gcc 3.4 gives a much better error message than
did previous versions, but it can still be confusing.

It does seem like it'd be perfectly straightforward to implement -- just 
drop the expression into the global constructor function and be done, but
as the attached test case shows, it's not quite that simple due to the parsing
of "register" outside the syntactic scope of a function.

-- 
           Summary: Accept statement expressions at top level
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rth at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org


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



More information about the Gcc-bugs mailing list