mirror of https://github.com/CGAL/cgal
Fix a bug with MSVC 2012 (VC11), in Interval_nt
The bug seems actually in VC11, but we use a workaround. The issue is how the compilateur optimizes, or not, the expression tested by an assertion.
This commit is contained in:
parent
02ff1276c2
commit
d345f1bafd
|
|
@ -131,9 +131,11 @@ public:
|
||||||
Interval_nt(double i, double s)
|
Interval_nt(double i, double s)
|
||||||
: _inf(i), _sup(s)
|
: _inf(i), _sup(s)
|
||||||
{
|
{
|
||||||
// VC++ should use instead : (i<=s) || !is_valid(i) || !is_valid(s)
|
// Previously it was:
|
||||||
// Or should I use is_valid() ? or is_valid_or_nan() ?
|
// CGAL_assertion_msg(!(i>s);
|
||||||
CGAL_assertion_msg(!(i>s),
|
// But MSVC++ 2012 optimizes the test "!(i>s)" to "i<=s", even with
|
||||||
|
// /fp:strict. If 'i' or 's' is a NaN, that makes a difference.
|
||||||
|
CGAL_assertion_msg( (!is_valid(i)) || (!is_valid(s)) || (!(i>s)),
|
||||||
" Variable used before being initialized (or CGAL bug)");
|
" Variable used before being initialized (or CGAL bug)");
|
||||||
#ifndef CGAL_DISABLE_ROUNDING_MATH_CHECK
|
#ifndef CGAL_DISABLE_ROUNDING_MATH_CHECK
|
||||||
CGAL_assertion_code((void) tester;) // Necessary to trigger a runtime test of rounding modes.
|
CGAL_assertion_code((void) tester;) // Necessary to trigger a runtime test of rounding modes.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue