[LLVMbugs] [Bug 18359] New: (N2439) Clang incorrectly reports ambiguity between reference-qualified member functions

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Jan 2 17:58:52 PST 2014


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: unassignedclangbugs at nondot.org
          Reporter: j4cbo at dropbox.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140103/d1aa57e4/attachment.html>


More information about the llvm-bugs mailing list