From a195bf86a21e9334c68eb5e4a5b0973104553460 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Bron?= Date: Tue, 22 May 2018 07:46:11 +0200 Subject: [PATCH] Make compilation with mingw-w64 possible with -std=c++17. The definition of macros min and max in include/wx/msw/wrapgdip.h b/include/wx/msw/wrapgdip.h was clashing with the new bessel functions that use std::numeric_limits::min/max. So #include before #include and use using declarations of std::min and max instead of macros. --- include/wx/msw/wrapgdip.h | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/include/wx/msw/wrapgdip.h b/include/wx/msw/wrapgdip.h index 7b12ea51f9..06f1401912 100644 --- a/include/wx/msw/wrapgdip.h +++ b/include/wx/msw/wrapgdip.h @@ -12,17 +12,14 @@ #include "wx/msw/wrapwin.h" -// these macros must be defined before gdiplus.h is included but we explicitly -// prevent windows.h from defining them in wx/msw/wrapwin.h as they conflict -// with standard functions of the same name elsewhere, so we have to pay for it -// by manually redefining them ourselves here -#ifndef max - #define max(a,b) (((a) > (b)) ? (a) : (b)) -#endif +// min and max must be available for gdiplus.h but we cannot define them as +// macros because they conflict with std::numeric_limits::min and max when +// compiling with mingw-w64 and -std=c++17. This happens because with c++17, +// math.h includes bessel_function which requires std::numeric_limits. -#ifndef min - #define min(a,b) (((a) < (b)) ? (a) : (b)) -#endif +#include +using std::min; +using std::max; // There are many clashes between the names of the member fields and parameters // in the standard gdiplus.h header and each of them results in C4458 with