https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86471

--- Comment #26 from Matt Bentley <mattreecebentley at gmail dot com> ---
(In reply to Jonathan Wakely from comment #25)

> What warning? Why can't you just pass 0 to __builtin_memset? It's a null
> pointer constant. I don't see any warning from clang when using -Weverything.

As corrected above, clang only issues the warning when comparing NULL to 0
without static_cast or reinterpret_cast.


> reinterpet_cast is forbidden in constexpr functions because it's purpose is
> to break the type system and say "trust me, I know what I'm doing", and such
> tricks are not allowed in constant expressions.

Yeah, but... why


> Using reinterpert_cast to convert 0 (a null pointer constant) into a pointer
> type is just silly and poor style. That conversion can be done implicitly,
> it doesn't need a sledgehammer to be used.

That's a bit of silly hyperbole I can do without.


> > But __builtin_constant_p allows it, so it's use is a matter of programmer
> > choice, at least in this context.
> 
> It really isn't if the standard requires the algorithm to be 'constexpr'
> (which we don't implement yet, but there's no point adding constructs which
> will just make life harder in the future).

Fair enough-
M@

Reply via email to