https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114410
--- Comment #3 from Cristian VOICA <cvoica at gmail dot com> --- be aware that is initial issue mentions "If the type of r is changed to const int&, the program correctly compiles with GCC" I have this in my code as well but this is not always what programmer wants as it creates a reference to a temporary object and extend the lifetime with const not aan lvalue const reference. If possible, a warning would be nice here