[libcxx-commits] [libcxx] [libc++] Define behaviour for calling target() and target_type() on -fno-rtti std::functions (PR #209471)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jul 30 04:11:52 PDT 2026


================
@@ -316,7 +314,9 @@ class __value_func<_Rp(_ArgTypes...)> {
   _LIBCPP_HIDE_FROM_ABI const std::type_info& target_type() const _NOEXCEPT {
     if (__f_ == nullptr)
       return typeid(void);
-    return __f_->target_type();
+    if (auto __ptr = __f_->target_type())
----------------
ldionne wrote:

If we make it an assertion, it would be closer to the current behavior and it would be narrower. I think that's the better alternative.

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


More information about the libcxx-commits mailing list