Nanako7_ix's blog

By Nanako7_ix, history, 2 weeks ago, In English

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.

  • Vote: I like it
  • +6
  • Vote: I do not like it

»
2 weeks ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by Nanako7_ix (previous revision, new revision, compare).