forked from OSchip/llvm-project
Fix bug 33389 - __is_transparent check requires too much
llvm-svn: 305292
This commit is contained in:
parent
0e27ce4271
commit
b707e7f391
|
@ -548,16 +548,13 @@ template <class _Tp> void cref(const _Tp&&) = delete;
|
|||
#endif
|
||||
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
template <class _Tp1, class _Tp2 = void>
|
||||
struct __is_transparent
|
||||
{
|
||||
private:
|
||||
struct __two {char __lx; char __lxx;};
|
||||
template <class _Up> static __two __test(...);
|
||||
template <class _Up> static char __test(typename _Up::is_transparent* = 0);
|
||||
public:
|
||||
static const bool value = sizeof(__test<_Tp1>(0)) == 1;
|
||||
};
|
||||
template <class _Tp, class, class = void>
|
||||
struct __is_transparent : false_type {};
|
||||
|
||||
template <class _Tp, class _Up>
|
||||
struct __is_transparent<_Tp, _Up,
|
||||
typename __void_t<typename _Tp::is_transparent>::type>
|
||||
: true_type {};
|
||||
#endif
|
||||
|
||||
// allocator_arg_t
|
||||
|
|
|
@ -28,7 +28,12 @@
|
|||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
typedef std::map<int, double, transparent_less> M;
|
||||
|
||||
M().count(C2Int{5});
|
||||
}
|
||||
{
|
||||
typedef std::map<int, double, transparent_less_not_referenceable> M;
|
||||
M().count(C2Int{5});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,12 @@
|
|||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
typedef std::map<int, double, transparent_less> M;
|
||||
|
||||
M().equal_range(C2Int{5});
|
||||
}
|
||||
{
|
||||
typedef std::map<int, double, transparent_less_not_referenceable> M;
|
||||
M().equal_range(C2Int{5});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,12 @@
|
|||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
typedef std::map<int, double, transparent_less> M;
|
||||
|
||||
M().find(C2Int{5});
|
||||
}
|
||||
{
|
||||
typedef std::map<int, double, transparent_less_not_referenceable> M;
|
||||
M().find(C2Int{5});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,12 @@
|
|||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
typedef std::map<int, double, transparent_less> M;
|
||||
|
||||
M().lower_bound(C2Int{5});
|
||||
}
|
||||
{
|
||||
typedef std::map<int, double, transparent_less_not_referenceable> M;
|
||||
M().lower_bound(C2Int{5});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,12 @@
|
|||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
typedef std::map<int, double, transparent_less> M;
|
||||
|
||||
M().upper_bound(C2Int{5});
|
||||
}
|
||||
{
|
||||
typedef std::map<int, double, transparent_less_not_referenceable> M;
|
||||
M().upper_bound(C2Int{5});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,12 @@
|
|||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
typedef std::multimap<int, double, transparent_less> M;
|
||||
|
||||
M().count(C2Int{5});
|
||||
}
|
||||
{
|
||||
typedef std::multimap<int, double, transparent_less_not_referenceable> M;
|
||||
M().count(C2Int{5});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,12 @@
|
|||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
typedef std::multimap<int, double, transparent_less> M;
|
||||
|
||||
M().equal_range(C2Int{5});
|
||||
}
|
||||
{
|
||||
typedef std::multimap<int, double, transparent_less_not_referenceable> M;
|
||||
M().equal_range(C2Int{5});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,12 @@
|
|||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
typedef std::multimap<int, double, transparent_less> M;
|
||||
|
||||
M().find(C2Int{5});
|
||||
}
|
||||
{
|
||||
typedef std::multimap<int, double, transparent_less_not_referenceable> M;
|
||||
M().find(C2Int{5});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,12 @@
|
|||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
typedef std::multimap<int, double, transparent_less> M;
|
||||
|
||||
M().lower_bound(C2Int{5});
|
||||
}
|
||||
{
|
||||
typedef std::multimap<int, double, transparent_less_not_referenceable> M;
|
||||
M().lower_bound(C2Int{5});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,12 @@
|
|||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
typedef std::multimap<int, double, transparent_less> M;
|
||||
|
||||
M().upper_bound(C2Int{5});
|
||||
}
|
||||
{
|
||||
typedef std::multimap<int, double, transparent_less_not_referenceable> M;
|
||||
M().upper_bound(C2Int{5});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,17 @@ struct transparent_less
|
|||
noexcept(noexcept(std::forward<T>(t) < std::forward<U>(u)))
|
||||
-> decltype (std::forward<T>(t) < std::forward<U>(u))
|
||||
{ return std::forward<T>(t) < std::forward<U>(u); }
|
||||
typedef void is_transparent; // correct
|
||||
using is_transparent = void; // correct
|
||||
};
|
||||
|
||||
struct transparent_less_not_referenceable
|
||||
{
|
||||
template <class T, class U>
|
||||
constexpr auto operator()(T&& t, U&& u) const
|
||||
noexcept(noexcept(std::forward<T>(t) < std::forward<U>(u)))
|
||||
-> decltype (std::forward<T>(t) < std::forward<U>(u))
|
||||
{ return std::forward<T>(t) < std::forward<U>(u); }
|
||||
using is_transparent = void () const &; // it's a type; a weird one, but a type
|
||||
};
|
||||
|
||||
struct transparent_less_no_type
|
||||
|
@ -33,7 +43,7 @@ struct transparent_less_no_type
|
|||
-> decltype (std::forward<T>(t) < std::forward<U>(u))
|
||||
{ return std::forward<T>(t) < std::forward<U>(u); }
|
||||
private:
|
||||
// typedef void is_transparent; // error - should exist
|
||||
// using is_transparent = void; // error - should exist
|
||||
};
|
||||
|
||||
struct transparent_less_private
|
||||
|
@ -44,7 +54,7 @@ struct transparent_less_private
|
|||
-> decltype (std::forward<T>(t) < std::forward<U>(u))
|
||||
{ return std::forward<T>(t) < std::forward<U>(u); }
|
||||
private:
|
||||
typedef void is_transparent; // error - should be accessible
|
||||
using is_transparent = void; // error - should be accessible
|
||||
};
|
||||
|
||||
struct transparent_less_not_a_type
|
||||
|
|
Loading…
Reference in New Issue