Boost logo

Boost :

Subject: Re: [boost] [test] BOOST_TEST macro and std::max
From: Gennadiy Rozental (rogeeff_at_[hidden])
Date: 2016-01-10 22:11:15

Benedek Thaler <thalerbenedek <at>> 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.

> my_report_assertion(
> E.evaluate(),
> (::boost::unit_test::lazy_ostream::instance() <<
> ::boost::unit_test::const_string( " ", sizeof( " ") - 1))
> );

Instance of temporary lazy_ostream is created at the same address as
unsigned int used to be and it changes the memory.

What is still unclear is WHY this is happening. Can you tell me what is the
value of BOOST_NO_CXX11_RVALUE_REFERENCES in our build?


Boost list run by bdawes at, gregod at, cpdaniel at, john at