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: unassignedclangb...@nondot.org
          Reporter: aaronpuch...@alice-dsl.net
                CC: llvm-bugs@lists.llvm.org, neeil...@live.com,
                    richard-l...@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to