#11887 closed Bugs (fixed)

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

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


Given the following program:

#include <algorithm>

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

  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)

Attachments (0)

Change History (7)

comment:1 Changed 18 months ago by renficiaud

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

comment:2 Changed 18 months ago by renficiaud

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 Changed 18 months ago by renficiaud

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


comment:4 Changed 18 months ago by renficiaud

  • Owner changed from rogeeff to renficiaud
  • Status changed from new to assigned

comment:5 Changed 18 months ago by Benedek Thaler

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

comment:6 Changed 18 months ago by renficiaud

  • Milestone changed from To Be Determined to Boost 1.61.0

Very good, thank you for the feedback!

comment:7 Changed 17 months ago by renficiaud

  • Resolution set to fixed
  • Status changed from assigned to closed


  • fd11b12dd6675a8d86ba54a21bce3f5f16f8c77e
  • 20e50a6d9444e5bb9bccdf51705b4e463c024853

Merged in master:

  • 2b918d0bd56cd2add28a1e35c6a2d0fd8c60cf90

Add Comment

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain renficiaud.
The resolution will be deleted. Next status will be 'reopened'.

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.