When building gdb with -std=c++20 I run into:
...
gdb/dwarf2/cooked-index.c: In lambda function:
gdb/dwarf2/cooked-index.c:471:47: error: implicit capture of ‘this’ via \
‘[=]’ is deprecated in C++20 [-Werror=deprecated]
471 | gdb::thread_pool::g_thread_pool->post_task ([=] ()
| ^
gdb/dwarf2/cooked-index.c:471:47: note: add explicit ‘this’ or ‘*this’ capture
...
Fix this and two more spots by removing the capture default, and explicitly
listing all captures.
Tested on x86_64-linux.
void
cooked_index_worker::start ()
{
- gdb::thread_pool::g_thread_pool->post_task ([=] ()
+ gdb::thread_pool::g_thread_pool->post_task ([this] ()
{
try
{
finalization. However, that would take a slot in the global
thread pool, and if enough such tasks were submitted at once, it
would cause a livelock. */
- gdb::task_group finalizers ([=] ()
+ gdb::task_group finalizers ([this, warn] ()
{
m_state->set (cooked_state::FINALIZED);
m_state->write_to_cache (index_for_writing (), warn);
}
gdb_assert (iter != last);
- workers.add_task ([=] ()
+ workers.add_task ([this, task_count, iter, last] ()
{
process_cus (task_count, iter, last);
});