| 1 | // { dg-do compile { target c++20 } } |
| 2 | |
| 3 | #include <vector> |
| 4 | |
| 5 | template<typename T> |
| 6 | struct Alloc |
| 7 | { |
| 8 | using value_type = T; |
| 9 | |
| 10 | Alloc(int) { } // not default constructible |
| 11 | |
| 12 | template<typename U> Alloc(const Alloc<U>&) { } |
| 13 | |
| 14 | T* allocate(std::size_t n) { return std::allocator<T>().allocate(n); } |
| 15 | void deallocate(T* p, std::size_t n) { std::allocator<T>().deallocate(p, n); } |
| 16 | }; |
| 17 | |
| 18 | template<typename T> struct wrap { T t; }; |
| 19 | |
| 20 | template<typename T> void do_adl(T&) { } |
| 21 | |
| 22 | void test_pr113841() |
| 23 | { |
| 24 | using test_type = std::vector<int, Alloc<int>>; |
| 25 | std::pair<const int, wrap<test_type>>* h = nullptr; |
| 26 | do_adl(h); |
| 27 | } |
| 28 | |
| 29 | void test_pr113841_bool() |
| 30 | { |
| 31 | using test_type = std::vector<bool, Alloc<bool>>; |
| 32 | std::pair<const int, wrap<test_type>>* h = nullptr; |
| 33 | do_adl(h); |
| 34 | } |