[libcxx-commits] [libcxx] [libc++] Add regression test for #67449 (PR #67590)

via libcxx-commits libcxx-commits at lists.llvm.org
Wed Sep 27 11:58:49 PDT 2023


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libcxx

<details>
<summary>Changes</summary>

Even though the underlying issue was fixed in #<!-- -->65177 when we made std::pointer_traits SFINAE-friendly, it is worth adding a regression test since it's so easy to do.

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


1 Files Affected:

- (modified) libcxx/test/std/utilities/memory/pointer.conversion/to_address.pass.cpp (+8) 


``````````diff
diff --git a/libcxx/test/std/utilities/memory/pointer.conversion/to_address.pass.cpp b/libcxx/test/std/utilities/memory/pointer.conversion/to_address.pass.cpp
index fea34ffe99de2bd..9ed0eeefcff829c 100644
--- a/libcxx/test/std/utilities/memory/pointer.conversion/to_address.pass.cpp
+++ b/libcxx/test/std/utilities/memory/pointer.conversion/to_address.pass.cpp
@@ -153,6 +153,14 @@ constexpr bool test() {
     assert(std::to_address(&p11) == &p11);
     ASSERT_SAME_TYPE(decltype(std::to_address(&p11)), int(**)());
 
+    // See https://github.com/llvm/llvm-project/issues/67449
+    {
+        struct S { };
+        S* p = nullptr;
+        assert(std::to_address<S>(p) == p);
+        ASSERT_SAME_TYPE(decltype(std::to_address<S>(p)), S*);
+    }
+
     return true;
 }
 

``````````

</details>


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


More information about the libcxx-commits mailing list