Removing MSVC C4800 from pragma block at the top of pybind11.h (#3141)

* Adding PYBIND11_COMPAT_BOOL_CAST to appease MSVC 2015 warning C4800.

* Replacing PYBIND11_COMPAT_BOOL_CAST with simpler != 0

* Extra parentheses (almost all compilers failed without these).
diff --git a/include/pybind11/buffer_info.h b/include/pybind11/buffer_info.h
index 47dc39d..eba68d1 100644
--- a/include/pybind11/buffer_info.h
+++ b/include/pybind11/buffer_info.h
@@ -83,7 +83,7 @@
             view->strides
             ? std::vector<ssize_t>(view->strides, view->strides + view->ndim)
             : detail::c_strides({view->shape, view->shape + view->ndim}, view->itemsize),
-            view->readonly) {
+            (view->readonly != 0)) {
         this->m_view = view;
         this->ownview = ownview;
     }
diff --git a/include/pybind11/cast.h b/include/pybind11/cast.h
index a748c77..1da4323 100644
--- a/include/pybind11/cast.h
+++ b/include/pybind11/cast.h
@@ -322,7 +322,7 @@
             }
             #endif
             if (res == 0 || res == 1) {
-                value = (bool) res;
+                value = (res != 0);
                 return true;
             }
             PyErr_Clear();
diff --git a/include/pybind11/detail/type_caster_base.h b/include/pybind11/detail/type_caster_base.h
index bdf3a39..a6b6bea 100644
--- a/include/pybind11/detail/type_caster_base.h
+++ b/include/pybind11/detail/type_caster_base.h
@@ -231,7 +231,7 @@
         return reinterpret_cast<V *&>(vh[0]);
     }
     // True if this `value_and_holder` has a non-null value pointer
-    explicit operator bool() const { return value_ptr(); }
+    explicit operator bool() const { return value_ptr() != nullptr; }
 
     template <typename H> H &holder() const {
         return reinterpret_cast<H &>(vh[1]);
@@ -252,7 +252,7 @@
     bool instance_registered() const {
         return inst->simple_layout
             ? inst->simple_instance_registered
-            : inst->nonsimple.status[index] & instance::status_instance_registered;
+            : ((inst->nonsimple.status[index] & instance::status_instance_registered) != 0);
     }
     void set_instance_registered(bool v = true) const {
         if (inst->simple_layout)
diff --git a/include/pybind11/pybind11.h b/include/pybind11/pybind11.h
index 9c0b723..93b920d 100644
--- a/include/pybind11/pybind11.h
+++ b/include/pybind11/pybind11.h
@@ -18,7 +18,6 @@
 #  pragma warning(push)
 #  pragma warning(disable: 4100) // warning C4100: Unreferenced formal parameter
 #  pragma warning(disable: 4127) // warning C4127: Conditional expression is constant
-#  pragma warning(disable: 4800) // warning C4800: 'int': forcing value to bool 'true' or 'false' (performance warning)
 #  pragma warning(disable: 4505) // warning C4505: 'PySlice_GetIndicesEx': unreferenced local function has been removed (PyPy only)
 #elif defined(__GNUG__) && !defined(__clang__)
 #  pragma GCC diagnostic push
diff --git a/include/pybind11/pytypes.h b/include/pybind11/pytypes.h
index 3329982..cea4e7e 100644
--- a/include/pybind11/pytypes.h
+++ b/include/pybind11/pytypes.h
@@ -367,7 +367,9 @@
     /// Check if the currently trapped error type matches the given Python exception class (or a
     /// subclass thereof).  May also be passed a tuple to search for any exception class matches in
     /// the given tuple.
-    bool matches(handle exc) const { return PyErr_GivenExceptionMatches(m_type.ptr(), exc.ptr()); }
+    bool matches(handle exc) const {
+        return (PyErr_GivenExceptionMatches(m_type.ptr(), exc.ptr()) != 0);
+    }
 
     const object& type() const { return m_type; }
     const object& value() const { return m_value; }
@@ -853,7 +855,7 @@
         Name(handle h, borrowed_t) : Parent(h, borrowed_t{}) { } \
         Name(handle h, stolen_t) : Parent(h, stolen_t{}) { } \
         PYBIND11_DEPRECATED("Use py::isinstance<py::python_type>(obj) instead") \
-        bool check() const { return m_ptr != nullptr && (bool) CheckFun(m_ptr); } \
+        bool check() const { return m_ptr != nullptr && (CheckFun(m_ptr) != 0); } \
         static bool check_(handle h) { return h.ptr() != nullptr && CheckFun(h.ptr()); } \
         template <typename Policy_> \
         Name(const ::pybind11::detail::accessor<Policy_> &a) : Name(object(a)) { }