[LLVMbugs] [Bug 6999] New: [C++ CodeGen] Reimplement synthesis of implicit copy assignment operators

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Apr 30 17:06:20 PDT 2010


           Summary: [C++ CodeGen] Reimplement synthesis of implicit copy
                    assignment operators
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: dgregor at apple.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com
            Blocks: 6023

terfin:clang dgregor$ cat t.cpp 
template<typename T>
CodeGen is picking the wrong copy-assignment operator for bases/members when it
synthesizes the implicit copy assignment operator. Here's an example (distilled
from Boost.Spirit) where we fail to link because CodeGen tries to call the
const copy-assignment operator when it should call the non-const one.

struct X {
  X &operator=(const X&) {
    T* a = 1;
    return *this;

  X &operator=(X &) { return *this; }

struct Y {
  Y &operator=(Y &) { return *this; }

struct Z : X<int>, Y { };

void test_Z(Z z1, Z z2) {
  z1 = z2;
terfin:clang dgregor$ clang++ t.cpp 
Undefined symbols:
  "_main", referenced from:
      start in crt1.10.6.o
  "__ZN1XIiEaSERKS0_", referenced from:
      __ZN1ZaSERS_ in cc-kOxAc3.o

The plan is to implement the generation of copy-assignment operators entirely
in Sema, synthesizing a body that CodeGen can translate like any other function

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