--- a/sources/shiboken2/libshiboken/basewrapper.cpp	2018-06-19 10:36:06.304233400 +0300
+++ b/sources/shiboken2/libshiboken/basewrapper.cpp	2018-06-19 10:36:06.304233400 +0300
@@ -1207,7 +1207,7 @@
 Py_hash_t hash(PyObject *pyObj)
 {
     assert(Shiboken::Object::checkType(pyObj));
-    return reinterpret_cast<Py_hash_t>(pyObj);
+    return reinterpret_cast<uintptr_t>(pyObj);
 }
 
 static void setSequenceOwnership(PyObject *pyObj, bool owner)
--- a/sources/shiboken2/tests/libsample/transform.cpp	2018-06-19 10:36:06.304233400 +0300
+++ b/sources/shiboken2/tests/libsample/transform.cpp	2018-06-19 10:36:06.304233400 +0300
@@ -32,7 +32,9 @@
 #ifdef _WIN32
 #include <math.h>
 #include <float.h>
+#ifndef __MINGW64_VERSION_MAJOR
 static inline bool isfinite(double a) { return _finite(a); }
+#endif
 #else
 #include <cmath>
 #endif
--- a/sources/shiboken2/libshiboken/typespec.cpp	2018-06-19 10:36:06.304233400 +0300
+++ b/sources/shiboken2/libshiboken/typespec.cpp	2018-06-19 10:38:32.154437600 +0300
@@ -48,8 +48,8 @@
 {
 
 // for some reason python 2.7 needs this on Windows
-#ifdef WIN32
-static PyGC_Head *_PyGC_generation0;
+#ifdef _WIN32
+PyGC_Head *_PyGC_generation0;
 #endif
 
 // from pymacro.h
diff -Naur a/sources/shiboken2/CMakeLists.txt b/sources/shiboken2/CMakeLists.txt
--- a/sources/shiboken2/CMakeLists.txt	2018-06-12 00:53:26.000000000 +0300
+++ b/sources/shiboken2/CMakeLists.txt	2018-06-19 16:21:51.647920900 +0300
@@ -143,7 +143,7 @@
 
 # Build with Address sanitizer enabled if requested.
 # This may break things, so use at your own risk.
-if (SANITIZE_ADDRESS AND NOT MSVC)
+if (SANITIZE_ADDRESS AND NOT WIN32)
     set_sanitize_address()
 endif()
 
diff -Naur a/sources/shiboken2/generator/generator.h b/sources/shiboken2/generator/generator.h
--- a/sources/shiboken2/generator/generator.h	2018-06-12 00:53:26.000000000 +0300
+++ b/sources/shiboken2/generator/generator.h	2018-06-19 16:23:02.031946600 +0300
@@ -89,7 +89,7 @@
  * when we can. This might change again when the Clang problem is solved.
  */
 
-#ifdef Q_CC_MSVC
+#if defined(Q_CC_MSVC) || defined(__MINGW32__)
 const int alwaysGenerateDestructor = 1;
 #else
 const int alwaysGenerateDestructor = 0;
