Opened 7 years ago

Closed 7 years ago

#11624 closed Bugs (fixed)

BOOST_TEST( 0.0 == 0.0 ) fails under C++11 (GCC and Clang)

Reported by: Tony Lewis <tonyelewis@…> Owned by: Raffi Enficiaud
Milestone: Boost 1.60.0 Component: test
Version: Boost 1.59.0 Severity: Problem
Keywords: BOOST_TEST, zero, C++11, float Cc:

Description

Thanks again for the new BOOST_TEST() tool, which looks very useful.

Unfortunately, I'm seeing strange behaviour from the following code under g++ -std=c++11 or clang++ -std=c++11 -stdlib=libc++ :

#define BOOST_TEST_MODULE zero_mod

#include <boost/test/included/unit_test.hpp>

BOOST_AUTO_TEST_CASE( zero ) {
        BOOST_TEST( 0.0 == 0.0 );
}

If I compile with -std=c++11, then the test fails:

error: in "zero": check 0.0 == 0.0 has failed [0 != 0]. Absolute value exceeds tolerance [|0| > 0]

...but I compile without any -std=[...] option, then the test passes.

Change History (7)

comment:1 by Gennadiy Rozental, 7 years ago

Resolution: fixed
Status: newclosed

thx for the report

comment:2 by Tony Lewis <tonyelewis@…>, 7 years ago

Thanks for the successful fix in the develop branch. Will this make it into 1.60.0?

comment:3 by Raffi Enficiaud, 7 years ago

Resolution: fixed
Status: closedreopened

Reopening to keep track of the merge to releases.

comment:4 by Raffi Enficiaud, 7 years ago

Milestone: To Be DeterminedBoost 1.60.0

comment:5 by Raffi Enficiaud, 7 years ago

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

comment:6 by Raffi Enficiaud, 7 years ago

Status: newassigned

comment:7 by Raffi Enficiaud, 7 years ago

Resolution: fixed
Status: assignedclosed

merged to master

Note: See TracTickets for help on using tickets.