[libcxx-commits] [PATCH] D128214: [libc++] Makes `unique_ptr operator*() noexcept.

Nikolas Klauser via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Jun 20 09:21:33 PDT 2022


philnik accepted this revision as: philnik.
philnik added a comment.

Could you include in the title that this isn't just modifying `unique_ptr`? Other than a few nits this LGTM assuming CI passes.



================
Comment at: libcxx/include/__memory/unique_ptr.h:270
 
-  _LIBCPP_INLINE_VISIBILITY
-  typename add_lvalue_reference<_Tp>::type
-  operator*() const {
+  _LIBCPP_INLINE_VISIBILITY typename add_lvalue_reference<_Tp>::type
+  operator*() const _NOEXCEPT_(_NOEXCEPT_(*declval<pointer>())) {
----------------
Maybe replace `_LIBCPP_INLINE_VISIBILITY` while you're at it?


================
Comment at: libcxx/include/__memory/unique_ptr.h:271
+  _LIBCPP_INLINE_VISIBILITY typename add_lvalue_reference<_Tp>::type
+  operator*() const _NOEXCEPT_(_NOEXCEPT_(*declval<pointer>())) {
     return *__ptr_.first();
----------------
It gets removed if `noexcept()` isn't supported anyways.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128214



More information about the libcxx-commits mailing list