libstdc++: Fix uses_allocator_construction args for cv pair (LWG 3677)
authorJonathan Wakely <jwakely@redhat.com>
Fri, 14 Oct 2022 13:25:48 +0000 (14:25 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Sat, 15 Oct 2022 20:17:48 +0000 (21:17 +0100)
commite24b430f1ea60205162fd9b327ac6a4dfc57f37c
tree396c77e65b9a271a52d3c72afb05f8b6175de5a8
parentbaeec7cc83b19b46d1c73523f06efa7ea2b30390
libstdc++: Fix uses_allocator_construction args for cv pair (LWG 3677)

The _Std_pair concept uses in <bits/uses_allocator_args.h> handles const
qualified pairs, but not volatile qualified. That's because it just uses
__is_pair which is specialized for const pairs.

This removes the partial specialization __is_pair<const pair<T,U>>, so
that __is_pair is now only true for cv-unqualified pairs. Then _Std_pair
needs to explicitly use remove_cv_t for the argument to __is_pair.

The other use of __is_pair is in map::insert(Pair&&) which doesn't want
to handle volatile so should just use remove_const_t.

libstdc++-v3/ChangeLog:

* include/bits/stl_map.h (map::insert(Pair&&)): Use
remove_const_t on argument to __is_pair.
* include/bits/stl_pair.h (__is_pair<const pair<T,U>>): Remove
partial specialization.
* include/bits/uses_allocator_args.h (_Std_pair): Use
remove_cv_t as per LWG 3677.
* testsuite/20_util/uses_allocator/lwg3677.cc: New test.
libstdc++-v3/include/bits/stl_map.h
libstdc++-v3/include/bits/stl_pair.h
libstdc++-v3/include/bits/uses_allocator_args.h
libstdc++-v3/testsuite/20_util/uses_allocator/lwg3677.cc [new file with mode: 0644]