This implements the C++23 P1518R2 proposal "Stop overconstraining allocators in container deduction guides" as a fix for C++17 and C++20 too. The changes allow class template argument deduction to ignore the type of a constructor argument that initializes an allocator_type parameter if the type should be deducible only from the other arguments. So for the constructor vector(const vector&, const allocator_type&) only the first argument is used for deduction, allowing the second argument to be anything that is implicitly convertible to argument_type. Previously deduction would fail or an ill-formed type would be deduced if the second argument wasn't of type allocator_type. The unordered containers do not need changes, because their allocator-extended constructors use the allocator_type alias, which comes from the dependent base class so is already a non-deduced context. libstdc++-v3/ChangeLog: * include/bits/forward_list.h (forward_list): Use non-deduced context for allocator parameter of allocator-extended copy and move constructors. * include/bits/stl_bvector.h (vector): Likewise. * include/bits/stl_deque.h (deque): Likewise. * include/bits/stl_list.h (list): Likewise. * include/bits/stl_map.h (map): Likewise. * include/bits/stl_multimap.h (multimap): Likewise. * include/bits/stl_multiset.h (multiset): Likewise. * include/bits/stl_set.h (set): Likewise. * include/bits/stl_vector.h (vector): Likewise. * include/bits/stl_queue.h (queue, priority_queue): Do not constrain Allocator template parameter of deduction guides that have a Container parameter. * include/bits/stl_stack.h (stack): Likewise. * include/debug/deque (__gnu_debug::deque): Use non-deduced context for allocator parameter of allocator-extended copy and move constructors. * include/debug/list (__gnu_debug::list): Likewise. * include/debug/map.h (__gnu_debug::map): Likewise. * include/debug/multimap.h (__gnu_debug::multimap): Likewise. * include/debug/multiset.h (__gnu_debug::multiset): Likewise. * include/debug/set.h (__gnu_debug::set): Likewise. * include/debug/vector (__gnu_debug::vector): Likewise. * testsuite/23_containers/deque/cons/deduction.cc: Test class template argument deduction with non-deduced allocator arguments. * testsuite/23_containers/forward_list/cons/deduction.cc: Likewise. * testsuite/23_containers/list/cons/deduction.cc: Likewise. * testsuite/23_containers/map/cons/deduction.cc: Likewise. * testsuite/23_containers/multimap/cons/deduction.cc: Likewise. * testsuite/23_containers/multiset/cons/deduction.cc: Likewise. * testsuite/23_containers/priority_queue/deduction.cc: Likewise. * testsuite/23_containers/queue/deduction.cc: Likewise. * testsuite/23_containers/set/cons/deduction.cc: Likewise. * testsuite/23_containers/stack/deduction.cc: Likewise. * testsuite/23_containers/unordered_map/cons/deduction.cc: Likewise. * testsuite/23_containers/unordered_multimap/cons/deduction.cc: Likewise. * testsuite/23_containers/unordered_multiset/cons/deduction.cc: Likewise. * testsuite/23_containers/unordered_set/cons/deduction.cc: Likewise. * testsuite/23_containers/vector/cons/deduction.cc: Likewise. Tested powerpc64le-linux. Committed to trunk.