[llvm-bugs] [Bug 34294] New: rvalue reference as constructor argument which implicit cast from operator() can not be cast implicitly to rvalue reference

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Aug 22 21:39:40 PDT 2017


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

            Bug ID: 34294
           Summary: rvalue reference as constructor argument which
                    implicit cast from operator() can not be cast
                    implicitly to rvalue reference
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: westion717 at gmail.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org

short s = 0;

class G {
public:
    operator short&& () { return (short&&)s; }
};

class A {
public:
    A(int  &&) { ; }
};

int main() {
    G g;
    A a(g);
    return 0;
}

clang++ a.C -std=c++11

a.C:15:9: error: no viable conversion from 'G' to 'int'
    A a(g);
        ^
a.C:5:5: note: candidate function
    operator short&& () { return (short&&)s; }
    ^
a.C:10:14: note: passing argument to parameter here
    A(int  &&) { ; }
             ^

-- 
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/20170823/646bf04d/attachment.html>


More information about the llvm-bugs mailing list