[Bug libstdc++/96803] std::tuple chooses wrong constructor for uses-allocator construction

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Aug 26 18:33:05 GMT 2020


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96803

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jonathan Wakely <redi@gcc.gnu.org>:

https://gcc.gnu.org/g:5494edae83ad33c769bd1ebc98f0c492453a6417

commit r11-2887-g5494edae83ad33c769bd1ebc98f0c492453a6417
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Wed Aug 26 19:32:30 2020 +0100

    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.


More information about the Gcc-bugs mailing list