From fa7aa6446b53d4fba520ae8d3965117752d2d3b4 Mon Sep 17 00:00:00 2001 From: Mathew Sutcliffe Date: Wed, 25 May 2016 19:25:52 +0100 Subject: [PATCH] refs #662 Work around MSVC2015 bug causing failure to detect getLogCategories() in some conditions. --- src/blackmisc/typetraits.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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.