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

             Bug #: 12194
           Summary: incorrect overload resolution result on C++11
                    container push_*
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++0x
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected], [email protected]
    Classification: Unclassified


Overload resolution selects a non-const&& parameter over a const& parameter for
a const argument:

struct X {};
struct L {
  void push(const X &);
  void push(X &&);
};
struct Y { operator const X() const; };

void f(L l) {
  Y y;
  l.push(y);
}

This gives:

/home/richardsmith/tmp.cpp:10:10: error: no viable conversion from 'Y' to 'X'
  l.push(y);
         ^
/home/richardsmith/tmp.cpp:1:8: note: candidate constructor (the implicit copy
      constructor) not viable: no known conversion from 'Y' to 'const X &' for
      1st argument;
struct X {};
       ^
/home/richardsmith/tmp.cpp:1:8: note: candidate constructor (the implicit move
      constructor) not viable: no known conversion from 'Y' to 'X &&' for 1st
      argument;
struct X {};
       ^
/home/richardsmith/tmp.cpp:6:12: note: candidate function
struct Y { operator const X() const; };
           ^
/home/richardsmith/tmp.cpp:4:17: note: passing argument to parameter here
  void push(X &&);
                ^

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