Debian Codegraph @

libstdc++-v3/testsuite/21_strings/basic_string/cons/113841.cc

raw
1 // { dg-do compile { target c++20 } }
2
3 #include <string>
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 Tr = std::char_traits<char>;
25 using test_type = std::basic_string<char, Tr, Alloc<char>>;
26 std::pair<const int, wrap<test_type>>* h = nullptr;
27 do_adl(h);
28 }