Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/llvm/llvm-project.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHoward Hinnant <hhinnant@apple.com>2011-05-22 19:07:43 +0400
committerHoward Hinnant <hhinnant@apple.com>2011-05-22 19:07:43 +0400
commit2fa07ae9a05a80313abe1185d9d73d2d7417936e (patch)
treeed42cce2fd3bed19db99072503b5e3d41821279b /libcxx/include/functional
parent408cfef6f051ab3d99a599f9091076c1d78ebbef (diff)
Fix const correctness bug in bind involving reference_wrapper found by Jonathan Sauer
llvm-svn: 131852
Diffstat (limited to 'libcxx/include/functional')
-rw-r--r--libcxx/include/functional22
1 files changed, 12 insertions, 10 deletions
diff --git a/libcxx/include/functional b/libcxx/include/functional
index aa2b4924d5d4..03e2c8162446 100644
--- a/libcxx/include/functional
+++ b/libcxx/include/functional
@@ -1567,24 +1567,31 @@ __mu(_Ti& __ti, _Uj& __uj)
return __ti;
}
-template <class _Ti, bool IsBindEx, bool IsPh, class _TupleUj>
+template <class _Ti, bool IsReferenceWrapper, bool IsBindEx, bool IsPh,
+ class _TupleUj>
struct ____mu_return;
template <class _Ti, class ..._Uj>
-struct ____mu_return<_Ti, true, false, tuple<_Uj...> >
+struct ____mu_return<_Ti, false, true, false, tuple<_Uj...> >
{
typedef typename __invoke_of<_Ti&, _Uj...>::type type;
};
template <class _Ti, class _TupleUj>
-struct ____mu_return<_Ti, false, true, _TupleUj>
+struct ____mu_return<_Ti, false, false, true, _TupleUj>
{
typedef typename tuple_element<is_placeholder<_Ti>::value - 1,
_TupleUj>::type&& type;
};
template <class _Ti, class _TupleUj>
-struct ____mu_return<_Ti, false, false, _TupleUj>
+struct ____mu_return<_Ti, true, false, false, _TupleUj>
+{
+ typedef typename _Ti::type& type;
+};
+
+template <class _Ti, class _TupleUj>
+struct ____mu_return<_Ti, false, false, false, _TupleUj>
{
typedef _Ti& type;
};
@@ -1592,18 +1599,13 @@ struct ____mu_return<_Ti, false, false, _TupleUj>
template <class _Ti, class _TupleUj>
struct __mu_return
: public ____mu_return<_Ti,
+ __is_reference_wrapper<_Ti>::value,
is_bind_expression<_Ti>::value,
0 < is_placeholder<_Ti>::value,
_TupleUj>
{
};
-template <class _Ti, class _TupleUj>
-struct __mu_return<reference_wrapper<_Ti>, _TupleUj>
-{
- typedef _Ti& type;
-};
-
template <class _F, class _BoundArgs, class _TupleUj>
struct __bind_return;