11 Jan
2016
11 Jan
'16
9:51 a.m.
2016-01-11 4:11 GMT+01:00 Gennadiy Rozental
Benedek Thaler
writes: I believe at this point we understand WHAT is going on.
auto const& E = ::boost::test_tools::assertion::seed()->*3u == ((std::max)(0u, 3u));
max returns unsigned int&&, which for some unclear reason is bound to unsigned int const& in expression template E. This obviously becomes dangling reference as soon as we leave this line.
This is an expected behavior in C++: an xvalue (rvalue reference returned from a function) can be bound to a const lvalue reference. See example: http://melpon.org/wandbox/permlink/yon7EWpj2B5KQNcT