[LLVMbugs] [Bug 9170] New: Bad diagnostic when passing non-rvalue to rvalue-reference

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Feb 8 15:49:01 PST 2011


           Summary: Bad diagnostic when passing non-rvalue to
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++0x
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: jyasskin at google.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com

The below diagnostic should say something about how you can't bind an lvalue
(even one declared as T&&, although that's not the problem in this case) to an
rvalue parameter.

$ cat ~/tmp/test.cc
struct vector {
  void swap(vector&& __x);

void foo() {
  vector v, u;
$  clang++  -std=gnu++0x -c ~/tmp/test.cc
/home/jyasskin/tmp/test.cc:7:10: error: binding of reference to type 'vector'
to a value
      of type 'vector' drops qualifiers
/home/jyasskin/tmp/test.cc:2:22: note: passing argument to parameter '__x' here
  void swap(vector&& __x);
1 error generated.

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