[LLVMbugs] [Bug 10107] New: Address of compound literal fails in gnu++0x but not C99

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Jun 9 00:42:15 PDT 2011


http://llvm.org/bugs/show_bug.cgi?id=10107

           Summary: Address of compound literal fails in gnu++0x but not
                    C99
           Product: clang
           Version: 2.9
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: 691D2C6C-B023-46A5-B1D7-ACCBA4713A87 at uuid-mail.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


The code below is C99 and supported by GCC in C++ mode since they allow 
C99 features.

Clang accepts the code in C99 mode, it (correctly) says that compound 
literals are a C99-specific feature in C++ mode, but with -std=gnu++0x 
(which should support GCC extensions, i.e. C99) I get the following 
error:

    error: taking the address of a temporary object of type 'struct 
point' [-Waddress-of-temporary]

----------8<----------

struct point { int x; int y; };
void draw_point (struct point const* aPoint) { }

int main (int argc, char const* argv[])
{
    draw_point(&(struct point){ 1, 2 });
    return 0;
}

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list