[Patch, libstdc++/68877] Reimplement __is_[nothrow_]swappable
Daniel Krügler
daniel.kruegler@gmail.com
Wed Dec 23 21:15:00 GMT 2015
This is a second try for a patch for libstdc++ bug 68877. See below
for responses.
2015-12-22 22:42 GMT+01:00 Jonathan Wakely <jwakely@redhat.com>:
> On 21/12/15 12:45 +0100, Daniel Krügler wrote:
>>
>> 2015-12-14 21:48 GMT+01:00 Daniel Krügler <daniel.kruegler@gmail.com>:
>>>
>>> This is a reimplementation of __is_swappable and
>>> __is_nothrow_swappable according to
>>>
>>> http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4511.html
>>>
>>> and also adds a missing usage of __is_nothrow_swappable in the swap
>>> overload for arrays. Strictly speaking the latter change differs from
>>> the Standard specification which requires the expression
>>> noexcept(swap(*a, *b)) to be used. On the other hand the Standard is
>>> broken in this regard, as pointed out by
>>>
>>> http://cplusplus.github.io/LWG/lwg-active.html#2554
>
> The patch doesn't apply cleanly because it repeats some of the new
> files either twice or three times (and also has some trailing
> whitespace that shouldn't be there).
I can confirm this, albeit I don't understand why this happens. I'm
using TortoiseSVN and when trying to create a patch file it creates
double entries for new directories. I have now explicitly removed the
added directories from the patch, I hope that your patch experience is
now better.
> After fixing the patch to only
> create new files once it applies, but then I get some FAILs:
>
> FAIL: 20_util/is_nothrow_swappable/value.cc (test for excess errors)
> FAIL: 20_util/is_swappable/value.cc (test for excess errors)
>
> I don't have time to analyse these today, so I'll wait until you're
> able to do so.
I'm sorry for these errors. I could now find a way to reproduce the
tests and found that they were partially due to an incomplete commit
and partially because of sleepiness on my side. I hopefully fixed
these blatant errors and took the chance to increase the test cases
even further.
Thanks again,
- Daniel
-------------- next part --------------
2015-12-23 Daniel Kruegler <daniel.kruegler@gmail.com>
PR libstdc++/68877
* include/std/type_traits: Following N4511, reimplement __is_swappable and
__is_nothrow_swappable. Move __is_swappable to namespace std, adjust
callers. Use __is_nothrow_swappable in swap.
* include/bits/move.h: Use __is_nothrow_swappable in swap.
* testsuite/20_util/is_nothrow_swappable/value.cc: Extend; remove
__is_swappable related tests.
* testsuite/20_util/is_swappable/value.cc: New.
* testsuite/20_util/is_swappable/requirements/explicit_instantiation.cc:
New.
* testsuite/20_util/is_swappable/requirements/typedefs.cc: New.
* testsuite/25_algorithms/swap/68877.cc: New.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 68877.patch
Type: application/octet-stream
Size: 26129 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20151223/9320cb18/attachment.obj>
More information about the Libstdc++
mailing list