This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[v3 PATCH] Protect allocator-overloads of tuple-from-tuple constructors from cases that would create dangling references.


The fix to avoid binding dangling references to temporaries for tuple's
constructors that take tuples of different type didn't include the fix
for allocator overloads. That was just lazy, and I should feel ashamed.
This patch fixes it, and takes us one step further to pass libc++'s testsuite
for tuple. The added _NonNestedTuple checks could actually be folded
into the recently-added _TMCT alias, but I'll do that as a separate cleanup
patch. For now, this should do as an easy and straightforward fix.

Tested on Linux-x64.

2016-05-28  Ville Voutilainen  <ville.voutilainen@gmail.com>

    Protect allocator-overloads of tuple-from-tuple constructors
    from cases that would create dangling references.
    * include/std/tuple (tuple(allocator_arg_t, const _Alloc&,
     const tuple<_UElements...>&), tuple(allocator_arg_t, const _Alloc&,
     tuple<_UElements...>&&)): Add a check for _NonNestedTuple.
    * testsuite/20_util/tuple/cons/nested_tuple_construct.cc: Adjust.

Attachment: nested_alloc_tuple.diff
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]