Update PYBIND11_CPP1{4,7} macros for MSVC

The PYBIND11_CPP14 macro started out as a guard for the compile-time
path code in `descr.h`, but has since come to mean other things.  This
means that while the `descr.h` check has just checked the
`PYBIND11_CPP14` macro, various other places now check `PYBIND11_CPP14
|| _MSC_VER`.  This reverses that by now setting the CPP14 macro when
MSVC is trying to support C++14, but disabling the `descr.h` C++14 code
(which still fails under MSVC 2017).

The CPP17 macro also gets enabled when MSVC 2017 is compiling with
/std:c++latest (the default is /std:c++14), which enables
`std::optional` and `std::variant` support under MSVC.
diff --git a/include/pybind11/common.h b/include/pybind11/common.h
index 58fc205..7c53638 100644
--- a/include/pybind11/common.h
+++ b/include/pybind11/common.h
@@ -16,9 +16,6 @@
 #  define NAMESPACE_END(name) }
 #endif
 
-// Neither MSVC nor Intel support enough of C++14 yet (in particular, as of MSVC 2015 and ICC 17
-// beta, neither support extended constexpr, which we rely on in descr.h), so don't enable pybind
-// CPP14 features for them.
 #if !defined(_MSC_VER) && !defined(__INTEL_COMPILER)
 #  if __cplusplus >= 201402L
 #    define PYBIND11_CPP14
@@ -26,6 +23,14 @@
 #      define PYBIND11_CPP17
 #    endif
 #  endif
+#elif defined(_MSC_VER)
+// MSVC sets _MSVC_LANG rather than __cplusplus (supposedly until the standard is fully implemented)
+#  if _MSVC_LANG >= 201402L
+#    define PYBIND11_CPP14
+#    if _MSVC_LANG > 201402L && _MSC_VER >= 1910
+#      define PYBIND11_CPP17
+#    endif
+#  endif
 #endif
 
 // Compiler version assertions
@@ -69,7 +74,7 @@
 #  define PYBIND11_NOINLINE __attribute__ ((noinline))
 #endif
 
-#if defined(PYBIND11_CPP14) || defined(_MSC_VER)
+#if defined(PYBIND11_CPP14)
 #  define PYBIND11_DEPRECATED(reason) [[deprecated(reason)]]
 #else
 #  define PYBIND11_DEPRECATED(reason) __attribute__((deprecated(reason)))
@@ -339,7 +344,7 @@
 inline internals &get_internals();
 
 /// from __cpp_future__ import (convenient aliases from C++14/17)
-#ifdef PYBIND11_CPP14
+#if defined(PYBIND11_CPP14) && (!defined(_MSC_VER) || _MSC_VER >= 1910)
 using std::enable_if_t;
 using std::conditional_t;
 using std::remove_cv_t;
@@ -350,7 +355,7 @@
 #endif
 
 /// Index sequences
-#if defined(PYBIND11_CPP14) || defined(_MSC_VER)
+#if defined(PYBIND11_CPP14)
 using std::index_sequence;
 using std::make_index_sequence;
 #else
@@ -622,8 +627,8 @@
 /// Dummy destructor wrapper that can be used to expose classes with a private destructor
 struct nodelete { template <typename T> void operator()(T*) { } };
 
-// overload_cast requires variable templates: C++14 or MSVC
-#if defined(PYBIND11_CPP14) || defined(_MSC_VER)
+// overload_cast requires variable templates: C++14
+#if defined(PYBIND11_CPP14)
 #define PYBIND11_OVERLOAD_CAST 1
 
 NAMESPACE_BEGIN(detail)
diff --git a/include/pybind11/descr.h b/include/pybind11/descr.h
index 2c3fb3d..6547660 100644
--- a/include/pybind11/descr.h
+++ b/include/pybind11/descr.h
@@ -15,7 +15,9 @@
 NAMESPACE_BEGIN(pybind11)
 NAMESPACE_BEGIN(detail)
 
-#if defined(PYBIND11_CPP14) /* Concatenate type signatures at compile time using C++14 */
+/* Concatenate type signatures at compile time using C++14 */
+#if defined(PYBIND11_CPP14) && !defined(_MSC_VER)
+#define PYBIND11_CONSTEXPR_DESCR
 
 template <size_t Size1, size_t Size2> class descr {
     template <size_t Size1_, size_t Size2_> friend class descr;
diff --git a/include/pybind11/pybind11.h b/include/pybind11/pybind11.h
index f00c0f9..098d7e0 100644
--- a/include/pybind11/pybind11.h
+++ b/include/pybind11/pybind11.h
@@ -252,7 +252,7 @@
         if (type_depth != 0 || types[type_index] != nullptr)
             pybind11_fail("Internal error while parsing type signature (2)");
 
-        #if !defined(PYBIND11_CPP14)
+        #if !defined(PYBIND11_CONSTEXPR_DESCR)
             delete[] types;
             delete[] text;
         #endif
diff --git a/include/pybind11/stl.h b/include/pybind11/stl.h
index 329ff64..8ca7fd3 100644
--- a/include/pybind11/stl.h
+++ b/include/pybind11/stl.h
@@ -41,6 +41,11 @@
 #    include <variant>
 #    define PYBIND11_HAS_VARIANT 1
 #  endif
+#elif defined(_MSC_VER) && defined(PYBIND11_CPP17)
+#  include <optional>
+#  include <variant>
+#  define PYBIND11_HAS_OPTIONAL 1
+#  define PYBIND11_HAS_VARIANT 1
 #endif
 
 NAMESPACE_BEGIN(pybind11)