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


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

Reply via email to