Date: Mon, 30 Mar 2026 07:53:41 +0100
On Mon, 30 Mar 2026, 00:56 Brian Bi, <bbi5291_at_[hidden]> wrote:
> I'm having trouble understanding this thread. I still can't figure out the
> answer to this question: does "Mandates:" allow defining a function as
> deleted, or not?
>
> Obviously, deleting a function is different from "Constraints". It's also
> different from putting a static assertion in the body, because if you test
> the validity of the call in an unevaluated context, e.g. using a
> requires-expression, then in the deleted case, you see that it's not valid,
> while in the case of a static assertion in the body, you see that it is
> valid, but then get a hard error if you retry the same call in an evaluated
> context.
>
> The impression I've been given at another point in time was that
> "Mandates:" is supposed to mean the latter behavior, but the library
> wording doesn't outright say that, because we're not sure whether every
> existing use of "Mandates:" is consistent with that. But, in the meantime,
> I don't see the value of having a note that goes against the intent.
>
The intent is that you can't use the function if the condition is not met.
Whether you can check its return type in an unevaluated context is
unspecified, and I don't see that as a problem. The examples given so far
in this thread are silly and/or contrived and don't persuade me that
there's any problem.
> I'm having trouble understanding this thread. I still can't figure out the
> answer to this question: does "Mandates:" allow defining a function as
> deleted, or not?
>
> Obviously, deleting a function is different from "Constraints". It's also
> different from putting a static assertion in the body, because if you test
> the validity of the call in an unevaluated context, e.g. using a
> requires-expression, then in the deleted case, you see that it's not valid,
> while in the case of a static assertion in the body, you see that it is
> valid, but then get a hard error if you retry the same call in an evaluated
> context.
>
> The impression I've been given at another point in time was that
> "Mandates:" is supposed to mean the latter behavior, but the library
> wording doesn't outright say that, because we're not sure whether every
> existing use of "Mandates:" is consistent with that. But, in the meantime,
> I don't see the value of having a note that goes against the intent.
>
The intent is that you can't use the function if the condition is not met.
Whether you can check its return type in an unevaluated context is
unspecified, and I don't see that as a problem. The examples given so far
in this thread are silly and/or contrived and don't persuade me that
there's any problem.
Received on 2026-03-30 06:53:58
