[libcxx-commits] [libcxx] [libcxx] address of all the things. (PR #102832)

via libcxx-commits libcxx-commits at lists.llvm.org
Sun Aug 11 15:04:27 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libcxx

Author: Nhat Nguyen  (changkhothuychung)

<details>
<summary>Changes</summary>

Fix #<!-- -->100248
LWG3131: addressof all the things

---
Full diff: https://github.com/llvm/llvm-project/pull/102832.diff


1 Files Affected:

- (modified) libcxx/include/string (+2-2) 


``````````diff
diff --git a/libcxx/include/string b/libcxx/include/string
index 9a52ab6aef41e8..8c2da057bd60c6 100644
--- a/libcxx/include/string
+++ b/libcxx/include/string
@@ -1630,11 +1630,11 @@ public:
 
   _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const value_type* c_str() const _NOEXCEPT { return data(); }
   _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const value_type* data() const _NOEXCEPT {
-    return std::__to_address(__get_pointer());
+    return std::addressof(__get_pointer());
   }
 #if _LIBCPP_STD_VER >= 17
   _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 value_type* data() _NOEXCEPT {
-    return std::__to_address(__get_pointer());
+    return std::addressof(__get_pointer());
   }
 #endif
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/102832


More information about the libcxx-commits mailing list