https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78209
Bug ID: 78209 Summary: rvalue reference binding to an lvalue accepted Product: gcc Version: 7.0 Status: UNCONFIRMED Keywords: accepts-invalid Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: trippels at gcc dot gnu.org CC: jason at gcc dot gnu.org Target Milestone: --- This came up on the isocpp mailing list yesterday: markus@x4 /tmp % cat test.ii int main() { int &&i = 0; decltype(auto) j = i; return j; } markus@x4 /tmp % clang++ test.ii test.ii:3:18: error: rvalue reference to type 'int' cannot bind to lvalue of type 'int' decltype(auto) j = i; ^ ~ 1 error generated. markus@x4 /tmp % icpc test.ii test.ii(3): error: an rvalue reference cannot be bound to an lvalue decltype(auto) j = i; ^ compilation aborted for test.ii (code 2) markus@x4 /tmp % g++ -Wall -Wextra test.ii markus@x4 /tmp %