[llvm-bugs] [Bug 25315] New: typeof rejects initialiser expression

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Oct 25 11:55:29 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=25315

            Bug ID: 25315
           Summary: typeof rejects initialiser expression
           Product: clang
           Version: 3.7
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: michael at araneidae.co.uk
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

The following code:


extern void *blah(void *arg);

const void *test2(const void *arg)
{
    return blah( ( {
        union {
            typeof((*(const void * []) { (arg) })) _value;
            void * _cast;
        } _union;
        _union._value = ((*(const void * []) { (arg) }));
        _union._cast;
    } ) );
}


generates the error:


test.c:7:43: error: initializer element is not a compile-time constant
            typeof((*(const void * []) { (arg) })) _value;
                                          ^~~
1 error generated.


This code compiles just fine with gcc, and if the typeof(...) expression is
replaced (with const void *) clang compiles this ok as well.

By the way, bug #11299 looks related, but I can't say if it really is.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20151025/17f5f41c/attachment.html>


More information about the llvm-bugs mailing list