Fix bug 33389 - __is_transparent check requires too much
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@305292 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -548,16 +548,13 @@ template <class _Tp> void cref(const _Tp&&) = delete;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if _LIBCPP_STD_VER > 11
|
#if _LIBCPP_STD_VER > 11
|
||||||
template <class _Tp1, class _Tp2 = void>
|
template <class _Tp, class, class = void>
|
||||||
struct __is_transparent
|
struct __is_transparent : false_type {};
|
||||||
{
|
|
||||||
private:
|
template <class _Tp, class _Up>
|
||||||
struct __two {char __lx; char __lxx;};
|
struct __is_transparent<_Tp, _Up,
|
||||||
template <class _Up> static __two __test(...);
|
typename __void_t<typename _Tp::is_transparent>::type>
|
||||||
template <class _Up> static char __test(typename _Up::is_transparent* = 0);
|
: true_type {};
|
||||||
public:
|
|
||||||
static const bool value = sizeof(__test<_Tp1>(0)) == 1;
|
|
||||||
};
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// allocator_arg_t
|
// allocator_arg_t
|
||||||
|
|||||||
@@ -27,8 +27,13 @@
|
|||||||
#include "is_transparent.h"
|
#include "is_transparent.h"
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
|
{
|
||||||
{
|
{
|
||||||
typedef std::map<int, double, transparent_less> M;
|
typedef std::map<int, double, transparent_less> M;
|
||||||
|
|
||||||
M().count(C2Int{5});
|
M().count(C2Int{5});
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
typedef std::map<int, double, transparent_less_not_referenceable> M;
|
||||||
|
M().count(C2Int{5});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -27,8 +27,13 @@
|
|||||||
#include "is_transparent.h"
|
#include "is_transparent.h"
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
|
{
|
||||||
{
|
{
|
||||||
typedef std::map<int, double, transparent_less> M;
|
typedef std::map<int, double, transparent_less> M;
|
||||||
|
|
||||||
M().equal_range(C2Int{5});
|
M().equal_range(C2Int{5});
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
typedef std::map<int, double, transparent_less_not_referenceable> M;
|
||||||
|
M().equal_range(C2Int{5});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -27,8 +27,13 @@
|
|||||||
#include "is_transparent.h"
|
#include "is_transparent.h"
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
|
{
|
||||||
{
|
{
|
||||||
typedef std::map<int, double, transparent_less> M;
|
typedef std::map<int, double, transparent_less> M;
|
||||||
|
|
||||||
M().find(C2Int{5});
|
M().find(C2Int{5});
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
typedef std::map<int, double, transparent_less_not_referenceable> M;
|
||||||
|
M().find(C2Int{5});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -27,8 +27,13 @@
|
|||||||
#include "is_transparent.h"
|
#include "is_transparent.h"
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
|
{
|
||||||
{
|
{
|
||||||
typedef std::map<int, double, transparent_less> M;
|
typedef std::map<int, double, transparent_less> M;
|
||||||
|
|
||||||
M().lower_bound(C2Int{5});
|
M().lower_bound(C2Int{5});
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
typedef std::map<int, double, transparent_less_not_referenceable> M;
|
||||||
|
M().lower_bound(C2Int{5});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -27,8 +27,13 @@
|
|||||||
#include "is_transparent.h"
|
#include "is_transparent.h"
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
|
{
|
||||||
{
|
{
|
||||||
typedef std::map<int, double, transparent_less> M;
|
typedef std::map<int, double, transparent_less> M;
|
||||||
|
|
||||||
M().upper_bound(C2Int{5});
|
M().upper_bound(C2Int{5});
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
typedef std::map<int, double, transparent_less_not_referenceable> M;
|
||||||
|
M().upper_bound(C2Int{5});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -27,8 +27,13 @@
|
|||||||
#include "is_transparent.h"
|
#include "is_transparent.h"
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
|
{
|
||||||
{
|
{
|
||||||
typedef std::multimap<int, double, transparent_less> M;
|
typedef std::multimap<int, double, transparent_less> M;
|
||||||
|
|
||||||
M().count(C2Int{5});
|
M().count(C2Int{5});
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
typedef std::multimap<int, double, transparent_less_not_referenceable> M;
|
||||||
|
M().count(C2Int{5});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -27,8 +27,13 @@
|
|||||||
#include "is_transparent.h"
|
#include "is_transparent.h"
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
|
{
|
||||||
{
|
{
|
||||||
typedef std::multimap<int, double, transparent_less> M;
|
typedef std::multimap<int, double, transparent_less> M;
|
||||||
|
|
||||||
M().equal_range(C2Int{5});
|
M().equal_range(C2Int{5});
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
typedef std::multimap<int, double, transparent_less_not_referenceable> M;
|
||||||
|
M().equal_range(C2Int{5});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -27,8 +27,13 @@
|
|||||||
#include "is_transparent.h"
|
#include "is_transparent.h"
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
|
{
|
||||||
{
|
{
|
||||||
typedef std::multimap<int, double, transparent_less> M;
|
typedef std::multimap<int, double, transparent_less> M;
|
||||||
|
|
||||||
M().find(C2Int{5});
|
M().find(C2Int{5});
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
typedef std::multimap<int, double, transparent_less_not_referenceable> M;
|
||||||
|
M().find(C2Int{5});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -27,8 +27,13 @@
|
|||||||
#include "is_transparent.h"
|
#include "is_transparent.h"
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
|
{
|
||||||
{
|
{
|
||||||
typedef std::multimap<int, double, transparent_less> M;
|
typedef std::multimap<int, double, transparent_less> M;
|
||||||
|
|
||||||
M().lower_bound(C2Int{5});
|
M().lower_bound(C2Int{5});
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
typedef std::multimap<int, double, transparent_less_not_referenceable> M;
|
||||||
|
M().lower_bound(C2Int{5});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -27,8 +27,13 @@
|
|||||||
#include "is_transparent.h"
|
#include "is_transparent.h"
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
|
{
|
||||||
{
|
{
|
||||||
typedef std::multimap<int, double, transparent_less> M;
|
typedef std::multimap<int, double, transparent_less> M;
|
||||||
|
|
||||||
M().upper_bound(C2Int{5});
|
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)))
|
noexcept(noexcept(std::forward<T>(t) < std::forward<U>(u)))
|
||||||
-> decltype (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); }
|
{ 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
|
struct transparent_less_no_type
|
||||||
@@ -33,7 +43,7 @@ struct transparent_less_no_type
|
|||||||
-> decltype (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); }
|
{ return std::forward<T>(t) < std::forward<U>(u); }
|
||||||
private:
|
private:
|
||||||
// typedef void is_transparent; // error - should exist
|
// using is_transparent = void; // error - should exist
|
||||||
};
|
};
|
||||||
|
|
||||||
struct transparent_less_private
|
struct transparent_less_private
|
||||||
@@ -44,7 +54,7 @@ struct transparent_less_private
|
|||||||
-> decltype (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); }
|
{ return std::forward<T>(t) < std::forward<U>(u); }
|
||||||
private:
|
private:
|
||||||
typedef void is_transparent; // error - should be accessible
|
using is_transparent = void; // error - should be accessible
|
||||||
};
|
};
|
||||||
|
|
||||||
struct transparent_less_not_a_type
|
struct transparent_less_not_a_type
|
||||||
|
|||||||
Reference in New Issue
Block a user