From 8634fc94e964f7af7af94aeeba7483048e037db1 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Fri, 7 Dec 2018 12:01:39 +0100 Subject: [PATCH] Fix a warning when `FT` is `int` https://cgal.geometryfactory.com/CGAL/testsuite/CGAL-4.14-Ic-63/Arrangement_on_surface_2_Examples/TestReport_Blake_Windows_MSVCPreview-Release-64bits.gz --- .../include/CGAL/constructions/kernel_ftC2.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Cartesian_kernel/include/CGAL/constructions/kernel_ftC2.h b/Cartesian_kernel/include/CGAL/constructions/kernel_ftC2.h index 144ec2695d2..f9bd5290086 100644 --- a/Cartesian_kernel/include/CGAL/constructions/kernel_ftC2.h +++ b/Cartesian_kernel/include/CGAL/constructions/kernel_ftC2.h @@ -28,6 +28,7 @@ #include #include +#include namespace CGAL { @@ -284,6 +285,15 @@ line_get_pointC2(const FT &a, const FT &b, const FT &c, int i, { if (CGAL_NTS is_zero(b)) { + // Laurent Rineau, 2018/12/07: I had this CGAL_assume to calm + // down a warning from MSVC 2017: + // > include\cgal\constructions\kernel_ftc2.h(287) : + // > warning C4723: potential divide by 0 + // The test `!boost::is_integral::value` is there to avoid + // that `a != 0` is tested on anything but integral types, for + // performance reasons. + CGAL_assume(!boost::is_integral::value || a != FT(0)); + x = -c/a; y = 1 - i * a; }