[PATCH gcc-16] libstdc++: Add constexpr to Debug Mode helpers for reflection vectors [PR124312]

Mishmish Dev mishmish@mishmish.dev
Thu Oct 22 21:33:53 GMT 2026


> If a valid constant-eval path exists, should they be constexpr on
> trunk too? Do you have examples of code that exercises such paths?

Yes, I found an example for two of them:

https://godbolt.org/z/nG5zPfe8s

With -std=c++20 -D_GLIBCXX_DEBUG the example fails on both gcc-16 and
trunk.  Copying the empty range calls _M_can_advance(0), which evaluates
_M_value_initialized().  Adding _GLIBCXX20_CONSTEXPR to those two helpers
makes it compile.

Those two should be fixed on trunk and backported separately.
For the remaining helpers, I have not found a reflection-independent
example using only the public API.


More information about the Libstdc++ mailing list