]> git.ipfire.org Git - thirdparty/gcc.git/commit
libstdc++: Fix use of make_pair that used ADL
authorJonathan Wakely <jwakely@redhat.com>
Wed, 12 Feb 2025 18:30:21 +0000 (18:30 +0000)
committerJonathan Wakely <redi@gcc.gnu.org>
Fri, 14 Feb 2025 15:33:12 +0000 (15:33 +0000)
commitd5fb86cbec48af24d3ec56519fdf8b0c4133b801
treea63337b3847dc1a340c12c96a44bd16ce8a27a90
parent5ced917508eee7eb499e19feeb3def1fa1842bb4
libstdc++: Fix use of make_pair that used ADL

_Rb_tree::_M_equal_range calls make_pair unqualified, which means it
uses ADL. As the new testcase shows, this can find something other than
std::make_pair. Rather than just changing it to use a qualified call,
remove the use of make_pair entirely. We don't need to deduce any types
here, we know exactly what type of std::pair we want to construct, so do
that explicitly.

libstdc++-v3/ChangeLog:

* include/bits/stl_tree.h (_Rb_tree::_M_equal_range): Replace
unqualified call to make_pair with explicit construction of
std::pair.
* testsuite/23_containers/set/operations/equal_range_adl.cc:
New test.
libstdc++-v3/include/bits/stl_tree.h
libstdc++-v3/testsuite/23_containers/set/operations/equal_range_adl.cc [new file with mode: 0644]