[Bug c++/53274] New: /*struct*/ S (__cdecl * f)(); fails to compile

sbergman at redhat dot com gcc-bugzilla@gcc.gnu.org
Tue May 8 07:21:00 GMT 2012


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

             Bug #: 53274
           Summary: /*struct*/ S (__cdecl * f)(); fails to compile
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: sbergman@redhat.com


At least with g++ 4.7.0 --target=i686-w64-mingw32, the compilation unit

  struct S { /*struct*/ S (__cdecl * f)(); };

fails with

test.cc:1:34: error: expected identifier before '*' token
test.cc:1:36: warning: '__cdecl__' attribute only applies to function types
[-Wattributes]
test.cc:1:39: error: 'S' declared as function returning a function

All errors and warnings go away when the "/*struct*/" is commented in.  (And
when removing the "__cdecl", it compiles fine with and without the commented-in
"struct".)

(This was originally reported to MinGW-w64 at
<sourceforge.net/support/tracker.php?aid=3514133>.)



More information about the Gcc-bugs mailing list