On Sat, 6 Jul 2019 at 06:12, Ed Smith-Rowland via libstdc++ <libstd...@gcc.gnu.org> wrote: > By my reckoning, you have a constexpr source array, an output array that > is initialized as it must be for constexpr.?? You have to have a > deterministic result after the copy.?? In the local array version the > actual iterator is not leaking out - just the results of a calculation > that must return one result. > > The only thing that 'helps' is removing the constexpr from the iterator > return and of course that's the whole point of the thing. > > Blargh!
But that's fine; the result of copy is not stored in a constexpr variable, but the function return is static_asserted so we have sufficiently tested that std::copy is indeed constexpr-compatible since it appears in a function that is evaluated at compile-time.