[libcxx-commits] [libcxx] [libc++] Optimize {std, ranges}::for_each for iterating over __trees (PR #164405)

Hans Wennborg via libcxx-commits libcxx-commits at lists.llvm.org
Fri Dec 12 01:48:13 PST 2025


zmodem wrote:

We're seeing build failures which seem related to this (https://crbug.com/468025338):

```
build step: cxx "./obj/ui/base/base/class_property.o"
siso_rule: clang-coverage/cxx
stderr:
In module 'std' imported from ../../ui/base/class_property.h:10:
gen/third_party/libc++/src/include/__tree:673:3: error: no matching function for call to object of type '(lambda at ../../ui/base/class_property.cc:51:35)'
  673 |   __func(static_cast<_Reference>(__root->__get_value()));
      |   ^~~~~~
gen/third_party/libc++/src/include/__tree:1545:10: note: in instantiation of function template specialization 'std::__tree_iterate_from_root<std::pair<const void *const, ui::PropertyHandler::Value> &, (lambda at gen/third_party/libc++/src/include/__tree:1546:9), std::__tree_node<std::__value_type<const void *, ui::PropertyHandler::Value>, void *> *, (lambda at ../../ui/base/class_property.cc:51:35), ui::PropertyHandler::Value std::pair<const void *const, ui::PropertyHandler::Value>::*>' requested here
 1545 |     std::__tree_iterate_from_root<__copy_cvref_t<_Tree, typename __remove_cvref_t<_Tree>::value_type>>(
      |          ^
../../ui/base/class_property.cc:51:35: note: candidate function not viable: no known conversion from 'std::pair<const void *const, ui::PropertyHandler::Value>' to 'Value &' for 1st argument
   51 |   static constexpr auto dealloc = [](Value& v) {
      |                                   ^  ~~~~~~~~
../../ui/base/class_property.cc:51:35: note: conversion candidate of type 'void (*)(Value &)'
1 error generated.
```

I don't have a reproducer yet, but figured I'd give an early heads up in case this rings any bell?

(The `for_each` call comes from here: https://source.chromium.org/chromium/chromium/src/+/main:ui/base/class_property.cc;l=56)

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


More information about the libcxx-commits mailing list