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: [email protected]
        ReportedBy: [email protected]
                CC: [email protected], [email protected]


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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to