Index: clang-tools-extra/trunk/clang-tidy/misc/ForwardingReferenceOverloadCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/misc/ForwardingReferenceOverloadCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/misc/ForwardingReferenceOverloadCheck.cpp @@ -40,6 +40,8 @@ if (const auto *Dependent = BaseType->getAs()) { BaseType = Dependent->getQualifier()->getAsType(); } + if (!BaseType) + return false; if (CheckTemplate(BaseType->getAs())) { return true; // Case: enable_if_t< >. } else if (const auto *Elaborated = BaseType->getAs()) { Index: clang-tools-extra/trunk/test/clang-tidy/misc-forwarding-reference-overload.cpp =================================================================== --- clang-tools-extra/trunk/test/clang-tidy/misc-forwarding-reference-overload.cpp +++ clang-tools-extra/trunk/test/clang-tidy/misc-forwarding-reference-overload.cpp @@ -121,3 +121,25 @@ private: Test6(const Test6 &rhs); }; + +// Do not dereference a null BaseType. +template class result_of; +template class result_of<_Fp(_Args...)> { }; +template using result_of_t = typename result_of<_Tp>::type; + +template struct __overload; +template +struct __overload<_Tp, _Types...> : __overload<_Types...> { + using __overload<_Types...>::operator(); +}; + +template +using __best_match_t = typename result_of_t<__overload<_Types...>(_Tp&&)>::type; + +template +class variant { +public: + template > + constexpr variant(_Arg&& __arg) {} + // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: constructor accepting a forwarding reference can hide the copy and move constructors +};