[PATCH] D26596: [RFC] Add _LIBCPP_NO_DISCARD and apply it to unique_ptr<T>::release()

David Blaikie via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 14 07:51:03 PST 2016


On Sun, Nov 13, 2016 at 1:30 PM Eric Fiselier via cfe-commits <
cfe-commits at lists.llvm.org> wrote:

> EricWF created this revision.
> EricWF added reviewers: mclow.lists, chandlerc.
> EricWF added a subscriber: cfe-commits.
>
> The title says it all.
>
> I just want to check that we agree on the general direction of this patch.
> Specifically that libc++ should be free to apply `no_discard` where we feel
> appropriate. If we agree then some other candidates are:
>
> - Containers `empty()` and `size()` methods.
> - `try_lock()` functions.
> - other `release()` functions.
>
> Additional suggestions welcome!
>

What sort of exceptions are there to a broader rule: all const member
functions (I suppose there's a few that return discardable results as well
as returning useful information via out parameters?)


>
> This patch fixes PR30898 (https://llvm.org/bugs/show_bug.cgi?id=30898)
>
>
> https://reviews.llvm.org/D26596
>
> Files:
>   include/__config
>   include/memory
>
> test/libcxx/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/release.fail.cpp
>
> test/libcxx/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.modifiers/release.fail.cpp
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161114/74fd5eb0/attachment.html>


More information about the cfe-commits mailing list