diff --git a/src/blackmisc/typetraits.h b/src/blackmisc/typetraits.h index 5ccce43c6..4c3f1b6e7 100644 --- a/src/blackmisc/typetraits.h +++ b/src/blackmisc/typetraits.h @@ -46,6 +46,21 @@ namespace BlackMisc struct HasToQString().toQString())>> : public std::true_type {}; //! \endcond +#ifdef Q_CC_MSVC // work around what seems to be an expression SFINAE bug in MSVC + namespace Private + { + struct HasGetLogCategoriesHelper + { + struct Base { int getLogCategories; }; + template struct Derived : public T, public Base {}; + template struct TypeCheck {}; + template static std::false_type test(TypeCheck::getLogCategories> *); + template static std::true_type test(...); + }; + } + template + using HasGetLogCategories = decltype(Private::HasGetLogCategoriesHelper::test(nullptr)); +#else /*! * Trait to detect whether a class T has a static member function named getLogCategories. */ @@ -55,6 +70,7 @@ namespace BlackMisc template struct HasGetLogCategories> : public std::true_type {}; //! \endcond +#endif /*! * Trait to detect whether a class T can be used as a key in a QHash.