path: root/src
diff options
authorThorbjørn Martsum <>2013-01-29 16:22:01 +0100
committerThe Qt Project <>2013-02-02 10:35:22 +0100
commitd0804ff2dd3d289a0f0c58aa30c4334e66ea9be0 (patch)
tree3650a71157af5ccb1c894edb454a3031ee4761e0 /src
parent29c80d0232b50a54f88e327db7c86492d659de65 (diff)
Provide better error if min (or max) is defined in QDateTime
This is better than getting a regular compiler error without knowing where min was previously defined. Change-Id: I5a86599cdf76a9a8d87a51e119543206d9f835c1 Reviewed-by: Mitch Curtis <> Reviewed-by: Thiago Macieira <>
Diffstat (limited to 'src')
1 files changed, 3 insertions, 0 deletions
diff --git a/src/corelib/tools/qdatetime.h b/src/corelib/tools/qdatetime.h
index d1cc10c877..d1d7f5792e 100644
--- a/src/corelib/tools/qdatetime.h
+++ b/src/corelib/tools/qdatetime.h
@@ -118,6 +118,9 @@ QT_DEPRECATED inline bool setYMD(int y, int m, int d)
inline qint64 toJulianDay() const { return jd; }
+#if defined(min) || defined(max)
+#error min or max defined, cannot continue. If this is caused by an #include of windows.h, NOMINMAX can be defined.
static inline qint64 nullJd() { return std::numeric_limits<qint64>::min(); }
static inline qint64 minJd() { return Q_INT64_C(-784350574879); }
static inline qint64 maxJd() { return Q_INT64_C( 784354017364); }