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

--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #6)
> Although arguably what clang does is more useful. I'm not sure why you'd
> want to use a non-constexpr size() or data() that only compiles as long as
> the static assertion passes. It means you won't find out that your
> user-generated message can't actually be printed until you run on a target
> where the assertion fails.

In the general case, the user-generated string might only be a constant
expression for some inputs, which is why it's unevaluated unless the assertion
fails. And the member functions being non-constexpr is only one of many ways in
which those functions could fail to be usable in constant expressions. So just
checking for constexpr members isn't sufficient to avoid the problem of a
message that can never be printed.

Reply via email to