[LLVMbugs] [Bug 12907] New: clang++ 3.1 trunk rejects unrestricted unions

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon May 21 17:27:57 PDT 2012


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

             Bug #: 12907
           Summary: clang++ 3.1 trunk rejects unrestricted unions
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: other
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++11
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: skarpio at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


As per the C++98/C++11 status page, Unrestricted unions have been implemented
in 3.1. I am currently using a Windows 7 box with the latest MinGW:

clang version 3.2 (trunk 157115) (llvm/trunk 157155)
Target: i686-pc-mingw32
Thread model: posix

However, the following code fails to compile (with the default `clang++
union.cpp -o union' command line):

#include <string>

struct Foo
{
  union U {
    int z;
    double w;
    std::string p;
  } u_; 
};

int main() {}

Error:

union.cpp:8:14: error: union member 'p' has a non-trivial copy constructor
        std::string p;
                    ^
c:/MinGW/lib/gcc/mingw32/4.6.2/include/c++\bits/basic_string.h:449:7: note:
      because type 'std::basic_string<char>' has a user-declared copy
      constructor
      basic_string(const basic_string& __str);
      ^
1 error generated.

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