[libcxx-commits] [libcxx] [libc++] Prevent ADL on _Block_copy/_Block_release (PR #179614)
A. Jiang via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Feb 3 22:16:07 PST 2026
================
@@ -540,7 +540,7 @@ class __func<_Rp1 (^)(_ArgTypes1...), _Rp(_ArgTypes...)> : public __base<_Rp(_Ar
# if __has_feature(objc_arc)
: __f_(__f)
# else
- : __f_(reinterpret_cast<__block_type>(__f ? _Block_copy(__f) : nullptr))
+ : __f_(reinterpret_cast<__block_type>(__f ? (_Block_copy)(__f) : nullptr))
----------------
frederick-vs-ja wrote:
Looks a bit weird to me. Can we use `::_Block_copy` instead? Ditto below.
Also, I think we should add test for this which uses "ADL-bomb" types, e.g.
```C++
struct incomplete;
template <class T>
struct holder { T t; };
using adl_unfriendly_block = holder<incomplete>* (^)();
```
https://github.com/llvm/llvm-project/pull/179614
More information about the libcxx-commits
mailing list