Skip to content

Bad diagnostic when passing non-rvalue to rvalue-reference #9542

@llvmbot

Description

@llvmbot
Bugzilla Link 9170
Resolution FIXED
Resolved on Apr 09, 2013 18:48
Version trunk
OS Linux
Reporter LLVM Bugzilla Contributor
CC @DougGregor,@belkadan

Extended Description

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;
v.swap(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
v.swap(u);
^
/home/jyasskin/tmp/test.cc:2:22: note: passing argument to parameter '__x' here
void swap(vector&& __x);
^
1 error generated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillac++11

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions