[LLVMbugs] [Bug 14279] New: mishandling of implicit move in class with copy-only member

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Nov 6 22:40:01 PST 2012


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

             Bug #: 14279
           Summary: mishandling of implicit move in class with copy-only
                    member
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: release blocker
          Priority: P
         Component: C++11
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: richard-llvm at metafoo.co.uk
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Consider this:

struct list {
  list() { p = this; }
  list(const list&) { p = this; }

  list *p;
};

struct val {
  val() : b() {}
  val(const val&) = default;
  val(val&&) = default;

  list b;
};

bool f(val &&v) {
  val w(static_cast<val&&>(v));
  return w.b.p == &w.b;
}

int main() {
  return f(val());
}

This program should return 1, since 'list' enforces that 'p == this'. Built
with Clang, it returns 0, because we implement val's move constructor with
memcpy, presumably because we incorrectly think that it's trivial.

This breaks self-host in C++11 mode using libstdc++-4.7.

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