[libcxx-commits] [libcxx] [libc++] Make forward_list constexpr as part of P3372R3 (PR #129435)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jun 11 09:13:33 PDT 2025


================
@@ -302,6 +302,14 @@ concept __resettable_smart_pointer_with_args = requires(_Smart __s, _Pointer __p
 
 #endif
 
+template <class _PtrTo, class _PtrFrom>
+_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI _PtrTo __static_fancy_pointer_cast(const _PtrFrom& __p) {
----------------
ldionne wrote:

I believe @winner245 's point is that if you have a `min_pointer` *actually* pointing to an object (as opposed to `nullptr`), then the cast fails in `constexpr`. For example, this is @philnik777's previous godbolt example modified to point to an actual object instead of default initializing the `min_pointer` (which requires making a private constructor public but that's besides the point): https://godbolt.org/z/dYbjz36Ec

Given this, I believe it is reasonable to unblock this patch landing and clean it up slightly after landing https://github.com/llvm/llvm-project/pull/130310 -- that's also the author's preference in terms of ease-of-rebasing.

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


More information about the libcxx-commits mailing list