libstdc++: Make byte-sized std::fill_n a constant expression (PR 94933)
The overload for byte types uses memset and isn't constexpr. This adds the specifier and uses std::is_constant_evaluated() to provide a compile-time alternative. Backport from mainline 2020-05-03 Jonathan Wakely <jwakely@redhat.com> PR libstdc++/94933 * include/bits/stl_algobase.h (__fill_a1): Make overload for byte types usable in constant expressions. * testsuite/25_algorithms/fill_n/constexpr.cc: Test with bytes and non-scalars.
Showing
Please
register
or
sign in
to comment