That's because it's in gcc 13,
https://gcc.gnu.org/gcc-13/changes.html


On Mon, Dec 12, 2022, 11:43 Pavel Vazharov via Std-Proposals <std-proposals@lists.isocpp.org> wrote:

I propose that we should be able to achieve this in C++26 with some
simple syntax as follows:

There is similar functionality already proposed by wg21.link/P0052.
https://en.cppreference.com/w/cpp/experimental/scope_exit
However, I don't see the above implemented in the libstdc++ for GCC 12.1.
--
Std-Proposals mailing list
Std-Proposals@lists.isocpp.org
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals