[libcxx-commits] [PATCH] D95251: Remove noexcept from basic_string::find and implementation functions.

Jonathan Wakely via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Jan 25 02:20:06 PST 2021


jwakely added a comment.

In D95251#2517099 <https://reviews.llvm.org/D95251#2517099>, @zoecarver wrote:

> So (again, if I understand correctly), I think all of these have a wide contract and should either be expected to throw or be marked noexcept.

No. The ones that construct a `basic_string_view` from a `const CharT*` (with or without a length) inherit the *Preconditions:* from the `basic_string_view` constructor. If they have a precondition, they have a narrow contract, by definition.

And those are the ones that are not marked `noexcept` in the standard (but can be marked `noexcept` in an implementation). It's OK for implementations to add `noexcept` to functions that can't throw, even if the standard doesn't say it's `noexcept`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D95251/new/

https://reviews.llvm.org/D95251



More information about the libcxx-commits mailing list