https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69060
Bug ID: 69060 Summary: Invalid 'cannot bind lvalue to rvalue' error Product: gcc Version: 6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: ldionne.2 at gmail dot com Target Milestone: --- The following code does not compile on GCC trunk (g++ 6.0.0 20151226 experimental): template <typename T> struct hold { T value; T&& operator()() && { return static_cast<T&&>(value); } }; bool result = hold<bool&&>{true}(); The error is [snip]/bin/g++ -pedantic -std=c++1y -W -Wall -Wextra -c ../test/worksheet.cpp ../test/worksheet.cpp: In instantiation of ‘T&& hold<T>::operator()() && [with T = bool&&]’: ../test/worksheet.cpp:1209:34: required from here ../test/worksheet.cpp:1205:38: error: cannot bind ‘bool’ lvalue to ‘bool&&’ return static_cast<T&&>(value); ^ Live example: http://melpon.org/wandbox/permlink/m9qGlrfGJLm218uh