[libcxx-commits] [PATCH] D95821: [docs] Explain noexcept policy for narrow contracts.

Zoe Carver via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Feb 1 14:15:09 PST 2021

zoecarver created this revision.
zoecarver added reviewers: mclow.lists, ldionne.
zoecarver requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.

Adds documentation around libc++'s policy to add noexcept to things that cannot throw but aren't marked as noexcept.

Refs LWG 3518 and D95251 <https://reviews.llvm.org/D95251>.

  rG LLVM Github Monorepo



Index: libcxx/docs/UsingLibcxx.rst
--- libcxx/docs/UsingLibcxx.rst
+++ libcxx/docs/UsingLibcxx.rst
@@ -346,3 +346,19 @@
 * ``unique``
 * ``upper_bound``
 * ``lock_guard``'s constructors
+.. _noexcept extension:
+Extended applications of ``noexcept``
+As of version 14 libc++ will mark functions that do not throw (i.e.,
+"Throws: nothing" as ``noexcept``). This means that functions will not
+report precondition violations by throwing and user-provided functions,
+such as custom predicates or custom traits, which throw will not be
+propagated up to the caller (unless specified otherwise by the standard).
+Before version 14, libc++ did not specify whether a function that did not
+throw would be marked as ``noexcept``, so users should not rely on any
+non-throwing functions to be marked ``noexcept`` (unless the standard
+specifies it).
\ No newline at end of file

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D95821.320598.patch
Type: text/x-patch
Size: 991 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210201/a281be5d/attachment.bin>

More information about the libcxx-commits mailing list