Блог пользователя Nanako7_ix

Автор Nanako7_ix, история, 2 недели назад, По-английски

I ran into a compiler bug when submitting with the C++23 (GCC 14-64, msys2) option on Codeforces.

The compilation error occurs in a recursive lambda inside a member function. In [&](this auto&& dfs, ...), dfs refers to the lambda itself, while this inside the lambda body refers to the enclosing object. Both info[u] and this->pull(u) are valid C++23. The affected GCC version mishandles the this capture and rejects both expressions. This is a known GCC bug (PR 113563).

If you want to use this style on Codeforces, my accepted submission shows a small workaround. Capture the pointer explicitly as [&, t = this], then write t->info[u] and t->pull(u). I hope Codeforces can update the C++23 compiler to a version that includes the fix soon.

Полный текст и комментарии »

  • Проголосовать: нравится
  • +6
  • Проголосовать: не нравится