libstdc++: Use correct argument type for __use_alloc [PR 96803]
authorJonathan Wakely <jwakely@redhat.com>
Wed, 26 Aug 2020 18:32:30 +0000 (19:32 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Wed, 26 Aug 2020 18:32:30 +0000 (19:32 +0100)
commit5494edae83ad33c769bd1ebc98f0c492453a6417
tree7eea5a73704c5afb870a066d9a5852b3b6b869cd
parent0c5df67ffcf421b8c532513a655a37839e632710
libstdc++: Use correct argument type for __use_alloc [PR 96803]

The _Tuple_impl constructor for allocator-extended construction from a
different tuple type uses the _Tuple_impl's own _Head type in the
__use_alloc test. That is incorrect, because the argument tuple could
have a different type. Using the wrong type might select the
leading-allocator convention when it should use the trailing-allocator
convention, or vice versa.

libstdc++-v3/ChangeLog:

PR libstdc++/96803
* include/std/tuple
(_Tuple_impl(allocator_arg_t, Alloc, const _Tuple_impl<U...>&)):
Replace parameter pack with a type parameter and a pack and pass
the first type to __use_alloc.
* testsuite/20_util/tuple/cons/96803.cc: New test.
libstdc++-v3/include/std/tuple
libstdc++-v3/testsuite/20_util/tuple/cons/96803.cc [new file with mode: 0644]