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: unassignedclangb...@nondot.org
          Reporter: mich...@araneidae.co.uk
                CC: llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to