[LLVMbugs] [Bug 13134] New: Diagnostics for "no viable conversion" with ref-qualified conversion operators.

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Jun 17 23:42:36 PDT 2012


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

             Bug #: 13134
           Summary: Diagnostics for "no viable conversion" with
                    ref-qualified conversion operators.
           Product: new-bugs
           Version: trunk
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: bigcheesegs at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Give the code:

struct B {

};

struct C {
  operator B() && {
    return B();
  }
};

int main() {
  C c;
  B b = c;
}

clang -std=c++11 currently prints:

refqual.cpp:13:5: error: no viable conversion from 'C' to 'B'
  B b = c;
    ^   ~
refqual.cpp:1:8: note: candidate constructor (the implicit copy constructor)
not viable: no known conversion from 'C' to

      'const B &' for 1st argument;
struct B {
       ^
refqual.cpp:1:8: note: candidate constructor (the implicit move constructor)
not viable: no known conversion from 'C' to

      'B &&' for 1st argument;
struct B {
       ^
refqual.cpp:6:3: note: candidate function not viable: no known conversion from
'C' to 'C' for object argument;
  operator B() && {
  ^

The first two notes are useless, and the last doesn't explain why C is not C.
It should at least mention that c is not an rvalue.

I would love it if clang proved a fixit to add std::move(c), but I'm not sure
this would be valid in most cases.

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