https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113841
--- Comment #10 from Jonathan Wakely <redi at gcc dot gnu.org> --- This one's much harder to fix: #include <string> template<typename T> struct Alloc { using value_type = T; Alloc(int) { } template<typename U> Alloc(const Alloc<U>&) { } T* allocate(std::size_t n) { return std::allocator<T>().allocate(n); } void deallocate(T* p, std::size_t n) { std::allocator<T>().deallocate(p, n); } }; template<typename T> struct wrap { T t; }; template<typename T> void do_adl(T&) { } void test_pr113841() { using Tr = std::char_traits<char>; using test_type = std::basic_string<char, Tr, Alloc<char>>; std::pair<const int, wrap<test_type>>* h = nullptr; do_adl(h); }