-
Notifications
You must be signed in to change notification settings - Fork 14.9k
Labels
libc++libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.regression:21Regression in 21 releaseRegression in 21 releaserejects-valid
Milestone
Description
In libc++ 21.1.0_rc2, calling find() on a map with a non-empty transparent comparator causes a compilation failure (no member named '__get_value' in 'std::pair<const std::string, int>'). The code below compiles just fine with libc++ 20.1.8, but fails with 21.1.0_rc2. This bug was found in the wild in PoDoFo 0.10.3, see https://bugs.gentoo.org/961184.
#include <map>
#include <string>
#include <string_view>
struct my_comp : std::less<> {
int i;
};
auto test(std::map<std::string, int, my_comp>& m, std::string_view v) {
m.find(v);
}
compilation error
In file included from test.cpp:1:
/usr/include/c++/v1/map:700:24: error: no member named '__get_value' in 'std::pair<const std::string, int>'
700 | return __comp_(__x.__get_value().first, __y);
| ~~~ ^
/usr/include/c++/v1/__tree:2050:10: note: in instantiation of function template specialization 'std::__map_value_compare<std::string, std::pair<const std::string,
int>, my_comp>::operator()<std::string_view>' requested here
2050 | if (!value_comp()(__root->__value_, __v)) {
| ^
/usr/include/c++/v1/__tree:1993:18: note: in instantiation of function template specialization 'std::__tree<std::__value_type<std::string, int>,
std::__map_value_compare<std::string, std::pair<const std::string, int>, my_comp>, std::allocator<std::pair<const std::string, int>>>::__lower_bound<std::string_view>' requested here
1993 | iterator __p = __lower_bound(__v, __root(), __end_node());
| ^
/usr/include/c++/v1/map:1249:20: note: in instantiation of function template specialization 'std::__tree<std::__value_type<std::string, int>,
std::__map_value_compare<std::string, std::pair<const std::string, int>, my_comp>, std::allocator<std::pair<const std::string, int>>>::find<std::string_view>' requested here
1249 | return __tree_.find(__k);
| ^
test.cpp:8:5: note: in instantiation of function template specialization 'std::map<std::string, int, my_comp>::find<std::string_view, 0>' requested here
8 | m.find(v);
| ^
In file included from test.cpp:1:
/usr/include/c++/v1/map:695:29: error: no member named '__get_value' in 'std::pair<const std::string, int>'
695 | return __comp_(__x, __y.__get_value().first);
| ~~~ ^
/usr/include/c++/v1/__tree:1994:24: note: in instantiation of function template specialization 'std::__map_value_compare<std::string, std::pair<const std::string,
int>, my_comp>::operator()<std::string_view>' requested here
1994 | if (__p != end() && !value_comp()(__v, *__p))
| ^
/usr/include/c++/v1/map:1249:20: note: in instantiation of function template specialization 'std::__tree<std::__value_type<std::string, int>,
std::__map_value_compare<std::string, std::pair<const std::string, int>, my_comp>, std::allocator<std::pair<const std::string, int>>>::find<std::string_view>' requested here
1249 | return __tree_.find(__k);
| ^
test.cpp:8:5: note: in instantiation of function template specialization 'std::map<std::string, int, my_comp>::find<std::string_view, 0>' requested here
8 | m.find(v);
| ^
2 errors generated.
Metadata
Metadata
Assignees
Labels
libc++libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.regression:21Regression in 21 releaseRegression in 21 releaserejects-valid
Type
Projects
Status
Done