[Bug c++/80265] __builtin_{memcmp,memchr,strlen} are not usable in constexpr functions

glisse at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sat Jan 19 08:08:00 GMT 2019


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

--- Comment #33 from Marc Glisse <glisse at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #8)
> I think there was a bug report in the last month or so asking for some
> builtin to detect when we're in a constexpr context.

Now that we have (__builtin_)is_constant_evaluated, does __constant_string_p
still serve a purpose, or could we replace it? ISTR __constant_string_p was
causing various issues (including PR 86590).

(In reply to Jason Merrill from comment #16)
> (In reply to Marc Glisse from comment #13)
> > it seems better than abusing __builtin_constant_p, which is getting
> > contradictory requirements from its various uses:
> > - constexpr (forces very early lowering)
> 
> I'm not sure what you mean here; constexpr specifically delays lowering
> within a constexpr function until we're actually trying to evaluate to a
> constant value.

Bug 85746 for instance, where the problem is how hard we should "try".


More information about the Gcc-bugs mailing list