@@ -619,23 +619,16 @@ class LocalAsMetadata : public ValueAsMetadata {
619
619
namespace mdconst {
620
620
621
621
namespace detail {
622
+ template <typename U, typename V>
623
+ using check_has_dereference = decltype (static_cast <V>(*std::declval<U &>()));
622
624
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;
628
628
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
- };
636
629
template <class V , class M > struct IsValidPointer {
637
630
static const bool value = std::is_base_of<Constant, V>::value &&
638
- HasDereference<M, const Metadata &>::value ;
631
+ HasDereference<M, const Metadata &>;
639
632
};
640
633
template <class V , class M > struct IsValidReference {
641
634
static const bool value = std::is_base_of<Constant, V>::value &&
0 commit comments