_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
equal_range(const _Key& __k)
{
+ typedef pair<iterator, iterator> _Ret;
+
_Base_ptr __x = _M_begin();
_Base_ptr __y = _M_end();
while (__x)
_Base_ptr __yu(__y);
__y = __x, __x = _S_left(__x);
__xu = _S_right(__xu);
- return make_pair(iterator(_M_lower_bound(__x, __y, __k)),
- iterator(_M_upper_bound(__xu, __yu, __k)));
+ return _Ret(iterator(_M_lower_bound(__x, __y, __k)),
+ iterator(_M_upper_bound(__xu, __yu, __k)));
}
}
- return pair<iterator, iterator>(iterator(__y),
- iterator(__y));
+ return _Ret(iterator(__y), iterator(__y));
}
template<typename _Key, typename _Val, typename _KeyOfValue,
_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
equal_range(const _Key& __k) const
{
+ typedef pair<const_iterator, const_iterator> _Ret;
+
_Base_ptr __x = _M_begin();
_Base_ptr __y = _M_end();
while (__x)
_Base_ptr __yu(__y);
__y = __x, __x = _S_left(__x);
__xu = _S_right(__xu);
- return make_pair(const_iterator(_M_lower_bound(__x, __y, __k)),
- const_iterator(_M_upper_bound(__xu, __yu, __k)));
+ return _Ret(const_iterator(_M_lower_bound(__x, __y, __k)),
+ const_iterator(_M_upper_bound(__xu, __yu, __k)));
}
}
- return pair<const_iterator, const_iterator>(const_iterator(__y),
- const_iterator(__y));
+ return _Ret(const_iterator(__y), const_iterator(__y));
}
template<typename _Key, typename _Val, typename _KeyOfValue,
--- /dev/null
+// { dg-do compile }
+
+#include <set>
+
+namespace adl
+{
+#if __cplusplus < 201103L
+ template<typename T> void make_pair(const T&, const T&) { }
+#else
+ template<typename T> void make_pair(T&&, T&&) { }
+#endif
+
+ struct X { bool operator<(const X&) const { return false; } };
+}
+
+typedef std::set<adl::X> Set;
+
+void
+test_equal_range(Set& s, const adl::X& x)
+{
+ // _Rb_tree::_M_equal_range was using make_pair unqualified.
+ (void) s.equal_range(x);
+ const Set& cs = s;
+ // Similarly for the const overload.
+ (void) cs.equal_range(x);
+}