[LLVMbugs] [Bug 10947] New: Discriminated unions miss move operations

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Sep 17 09:33:44 PDT 2011


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

           Summary: Discriminated unions miss move operations
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++0x
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: aaron at aaronballman.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


According to [class.union]p2, a discriminated union cannot contain and move
constructors or move assignments.  However, the following code will compile:

// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s

void abort() __attribute__((noreturn));

class clsMC {    // expected-note {{because type 'clsMC' has a user-defined
move constructor}}
public:
  clsMC( const clsMC&& rhs ) { abort(); }
};

class clsMA {    // expected-note {{because type 'clsMA' has a user-defined
move assignment operator}}
public:
    clsMA&& operator= (clsMA&& rhs) { abort(); }
};

union u {
    clsMC a;    // expected-error {{union member 'a' has a non-trivial move
constructor}}
    clsMA b;    // expected-error {{union member 'b' has a non-trivial move
assignment operator}}
};

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