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

            Bug ID: 18359
           Summary: (N2439) Clang incorrectly reports ambiguity between
                    reference-qualified member functions
           Product: clang
           Version: 3.3
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
    Classification: Unclassified

Given the following:

  #include <memory>
  using std::shared_ptr;

  struct Foo {
      operator shared_ptr<int> const & () const & { return data; }
      operator shared_ptr<int> &&      () &&      { return std::move(data); }
      shared_ptr<int> data;
  };

  int main() {
      shared_ptr<int> x;
      x = Foo();
  }

Clang ("Apple LLVM version 5.0 (clang-500.2.75) (based on LLVM 3.3svn)")
reports:

  ambiguous-reference.cpp:12:7: error: use of overloaded operator '=' is
ambiguous (with operand types 'shared_ptr<int>' and 'Foo')

This seems wrong - if I'm understanding N2439 correctly, then the
rvalue-reference-qualified version should be preferred.

Replacing shared_ptr with unique_ptr in the above also fails due to ambiguity,
even though one of the two candidates (uniuqe_ptr's copy assignment operator)
is implicitly deleted.

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