[LLVMbugs] [Bug 10954] New: Incorrectly building an initializer for every union member

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Sep 18 04:01:12 PDT 2011


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

           Summary: Incorrectly building an initializer for every union
                    member
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++0x
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: richard-llvm at metafoo.co.uk
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


clang tries to create an implicit initializer for every member of a union:

$ cat union.cpp
struct S { S(char); };

union U {
  S s; int n;
  U() : n(0) {}
};
$ clang++ -std=c++0x union.cpp
union.cpp:5:3: error: constructor for 'U' must explicitly initialize the member
     's' which does not have a default constructor
  U() : n(0) {}
  ^
union.cpp:4:5: note: member is declared here
  S s; int n;
    ^
union.cpp:1:8: note: 'S' declared here
struct S { S(char); };
       ^

-- 
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