@@ -619,23 +619,16 @@ class LocalAsMetadata : public ValueAsMetadata {
619619namespace mdconst {
620620
621621namespace detail {
622+ template <typename U, typename V>
623+ using check_has_dereference = decltype (static_cast <V>(*std::declval<U &>()));
622624
623- template <class T > T &make ();
624- template <class T , class Result > struct HasDereference {
625- using Yes = char [1 ];
626- using No = char [2 ];
627- template <size_t N> struct SFINAE {};
625+ template <typename U, typename V>
626+ static constexpr bool HasDereference =
627+ is_detected<check_has_dereference, U, V>::value;
628628
629- template <class U , class V >
630- static Yes &hasDereference (SFINAE<sizeof (static_cast <V>(*make<U>()))> * = 0);
631- template <class U , class V > static No &hasDereference (...);
632-
633- static const bool value =
634- sizeof (hasDereference<T, Result>(nullptr )) == sizeof (Yes);
635- };
636629template <class V , class M > struct IsValidPointer {
637630 static const bool value = std::is_base_of<Constant, V>::value &&
638- HasDereference<M, const Metadata &>::value ;
631+ HasDereference<M, const Metadata &>;
639632};
640633template <class V , class M > struct IsValidReference {
641634 static const bool value = std::is_base_of<Constant, V>::value &&
0 commit comments