[PATCH] c++: Add std::to_underlying to the set of stdlib functions that are always folded

Ville Voutilainen ville.voutilainen@gmail.com
Mon May 12 20:32:13 GMT 2025


This function is yet another stdlib function that is just a simple
cast, so having
it appear while debugging is arguably not useful. So add it to the
existing handling
that always-folds some stdlib functions.

Add std::to_underlying to the set of stdlib functions that are always folded

gcc/cp/ChangeLog:
        * cp-gimplify.cc (cp_fold): Add to_underlying.

gcc/testsuite/ChangeLog:
        * g++.dg/opt/pr96780_cpp23.C: New.

libstdc++/ChangeLog:
        * include/std/utility (to_underlying): Add the
__always_inline__ attribute.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: to_underlying_fold.diff
Type: text/x-patch
Size: 2555 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/libstdc++/attachments/20250512/9f059857/attachment.bin>


More information about the Libstdc++ mailing list