Opened 7 years ago

Closed 7 years ago

#11887 closed Bugs (fixed)

BOOST_TEST(3u == (std::max)(0u, 3u)) fails

Reported by: Benedek Thaler Owned by: Raffi Enficiaud
Milestone: Boost 1.61.0 Component: test
Version: Boost 1.60.0 Severity: Problem
Keywords: Cc:

Description

Given the following program:

#include <algorithm>

#define BOOST_TEST_MODULE sandbox
#include <boost/test/included/unit_test.hpp>

BOOST_AUTO_TEST_CASE(sandbox)
{
  BOOST_TEST(3u == ((std::max)(0u, 3u)));
}

The check fails with:

check 3u == ((std::max)(0u, 3u)) has failed [3 != 7095312]

(The large number on the right hand side is not specific, depends on the program)

Change History (7)

comment:1 by Raffi Enficiaud, 7 years ago

Would you please provide the compilation line? especially, I would like to know it you are using C++11.

comment:2 by Raffi Enficiaud, 7 years ago

From your post on the ML and the trace, I see that the right operand is bound to unsigned int & while it should be unsigned int.

comment:3 by Raffi Enficiaud, 7 years ago

Would you please try running your example against branch fix/handling-rvalue-erasure?

Thanks

comment:4 by Raffi Enficiaud, 7 years ago

Owner: changed from Gennadiy Rozental to Raffi Enficiaud
Status: newassigned

comment:5 by Benedek Thaler, 7 years ago

Works for me after applying fix/handling-rvalue-erasure

comment:6 by Raffi Enficiaud, 7 years ago

Milestone: To Be DeterminedBoost 1.61.0

Very good, thank you for the feedback!

comment:7 by Raffi Enficiaud, 7 years ago

Resolution: fixed
Status: assignedclosed

Commits

  • fd11b12dd6675a8d86ba54a21bce3f5f16f8c77e
  • 20e50a6d9444e5bb9bccdf51705b4e463c024853

Merged in master:

  • 2b918d0bd56cd2add28a1e35c6a2d0fd8c60cf90
Note: See TracTickets for help on using tickets.