From 4186b8fff23b3f897021999cb67f086a2e14236a Mon Sep 17 00:00:00 2001 From: Jonas Gehring Date: Fri, 14 Dec 2018 14:05:58 +0000 Subject: [PATCH] Workaround MSVC ICE Credits to https://gist.github.com/phraemer/ec840ff8c7ab2972e7c3731e07b71edc --- prettyprint.hpp | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/prettyprint.hpp b/prettyprint.hpp index f75683c..952a0eb 100644 --- a/prettyprint.hpp +++ b/prettyprint.hpp @@ -49,17 +49,33 @@ namespace pretty_print struct has_begin_end : private sfinae_base { private: +#ifdef _MSC_VER + // Work around MSVC ICE in 15.9.x by moving decltype out to template + // typename + template + static yes & f(typename std::enable_if< + std::is_same(&C::begin)), + typename C::const_iterator(C::*)() const>::value>::type *); +#else // _MSCV_VER template static yes & f(typename std::enable_if< std::is_same(&C::begin)), typename C::const_iterator(C::*)() const>::value>::type *); +#endif // _MSCV_VER template static no & f(...); +#ifdef _MSC_VER + template + static yes & g(typename std::enable_if< + std::is_same(&C::end)), + typename C::const_iterator(C::*)() const>::value, void>::type*); +#else // _MSCV_VER template static yes & g(typename std::enable_if< - std::is_same(&C::end)), - typename C::const_iterator(C::*)() const>::value, void>::type*); + std::is_same(&C::end)), + typename C::const_iterator(C::*)() const>::value, void>::type*); +#endif // _MSCV_VER template static no & g(...);