[Bug middle-end/86471] GCC/libstdc++ outputs inferior code for std::fill and std::fill_n vs std::memset on c-style arrays
mattreecebentley at gmail dot com
gcc-bugzilla@gcc.gnu.org
Fri Jul 20 01:49:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86471
--- Comment #23 from Matt Bentley <mattreecebentley at gmail dot com> ---
> Actually, don't quote me on that - I may be thinking of the
> 'reinterpret_cast<_Tp>(0)' - one of the two.
Just to confirm, "reinterpret_cast<void *>(__first)" not required in this
context, either "reinterpret_cast<_Tp>(0)" or "static_cast<_Tp>(0)" *are*
required to avoid warnings in clang when _Tp is a pointer. Either works fine.
I understand that reinterpret_cast isn't allowed inside constexpr, but not why,
and can't find any resources explicitly stating the reasoning.
But __builtin_constant_p allows it, so it's use is a matter of programmer
choice, at least in this context.
More information about the Gcc-bugs
mailing list