[LLVMbugs] [Bug 10285] New: Improper assignment operator overload resolution

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Jul 6 08:59:31 PDT 2011


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

           Summary: Improper assignment operator overload resolution
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++0x
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: hhinnant at apple.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


Apple clang version 3.0 (trunk 134483) (based on LLVM 3.0svn)
Target: x86_64-apple-darwin11.0.0
Thread model: posix

$  clang++ -std=c++0x test.cpp

class A
{
public:
    A() {}

    template <class _F>
        explicit A(_F&& __f);

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

template <class T>
void sort(T t)
{
    A a;
    a = A(t);
}

int main()
{
    sort(4);
}


test.cpp:18:7: error: overload resolution selected deleted operator '='
    a = A(t);
    ~ ^ ~~~~
test.cpp:2:7: note: candidate function (the implicit copy assignment operator)
has been explicitly deleted
class A
      ^
test.cpp:11:8: note: candidate function not viable: no known conversion from
'A' to 'A &&' for 1st argument
    A& operator=(A&&) {return *this;}
       ^
1 error generated.

I expect it to compile, selecting the 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