[cfe-dev] typeof( compound expression ) for a struct member type

Eyal Lotem eyal.lotem at gmail.com
Sat Aug 2 13:02:24 PDT 2014


Hey,

The following code:

int main(void)
{
    struct s {
        typeof( ({ int x = 0; x; }) ) y;
    };
}

appears to be valid, and is accepted by gcc.

But it is rejected by clang:

clangtest.c:4:24: error: non-const static data member must be initialized
out of line
        typeof( ({ int x = 0; x; }) ) y;
                       ^   ~
clangtest.c:4:17: error: statement expression not allowed at file scope
        typeof( ({ int x = 0; x; }) ) y;

Is this a bug, or intended behavior?

-- 
Eyal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140802/86f48481/attachment.html>


More information about the cfe-dev mailing list