[committed] libstdc++: Use correct argument type for __use_alloc [PR 96803]
Jonathan Wakely
jwakely@redhat.com
Tue Sep 22 07:43:35 GMT 2020
On 26/08/20 19:34 +0100, Jonathan Wakely wrote:
>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.
While backporting 5494edae83ad33c769bd1ebc98f0c492453a6417 I noticed
that it's still not correct. I made the allocator-extended constructor
use the right type for the uses-allocator construction detection, but I
used an rvalue when it should be a const lvalue.
This should fix it properly this time.
libstdc++-v3/ChangeLog:
PR libstdc++/96803
* include/std/tuple
(_Tuple_impl(allocator_arg_t, Alloc, const _Tuple_impl<U...>&)):
Use correct value category in __use_alloc call.
* testsuite/20_util/tuple/cons/96803.cc: Check with constructors
that require correct value category to be used.
Tested powerpc64le-linux. Committed to trunk.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.txt
Type: text/x-patch
Size: 2365 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/libstdc++/attachments/20200922/72b16574/attachment.bin>
More information about the Libstdc++
mailing list