[llvm-bugs] [Bug 47791] New: Strange note when calling lvalue-qualified method on rvalue

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Oct 10 14:39:03 PDT 2020


https://bugs.llvm.org/show_bug.cgi?id=47791

            Bug ID: 47791
           Summary: Strange note when calling lvalue-qualified method on
                    rvalue
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: aaronpuchert at alice-dsl.net
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at metafoo.co.uk

When compiling this with -fsyntax-only:

struct X {
    X& operator=(const X&) &;
};

X f();
void g(const X& x) {
    f() = x;
}

We get

<stdin>:7:9: error: no viable overloaded '='
    f() = 2;
    ~~~ ^ ~
<stdin>:2:8: note: candidate function not viable: no known conversion from 'X'
to 'X' for object argument
    X& operator=(const X&) &;
       ^

The error is expected, but the note is confusing: why would we need a
conversion from 'X' to 'X'? The problem here is not the type, but the value
category.

-- 
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/20201010/4cf84562/attachment-0001.html>


More information about the llvm-bugs mailing list