C++ Logo

std-discussion

Advanced search

Re: atomic constraint rules vs requires-clause rules

From: Jens Maurer <jens.maurer_at_[hidden]>
Date: Tue, 25 Feb 2025 22:28:32 +0100
On 25/02/2025 16.22, mauro russo wrote:
>>> Since CWG2461 there's no equivalent of [expr.prim.req.general]/5 for
>>> atomic constraints. (Maybe there should be; I'm not entirely convinced
>>> the removal was intentional.)
>
>> [temp.constr.atomic] p3 says the satisfaction check includes
>> the substitution step, so I think CWG2461 didn't remove anything.
>
> Thank you Jens for the clarification.
>
> I hope you may help also on the initial topic
> about the statement from [temp.res.general]-p(6.4) ?
> Here below the thread on it wih M.P. :
>
> From me:
>>>> The point is: for a requires-expression that case (not
>>>> possible to satisfy) is always IFNDR, whereas for a
>>>> constraint-expression it reads that IFNDR is in place
>>>> only if no satisfation check is actually performed.

The general structure of the IFNDR list in [temp.res.general] p6
is that IFNDR triggers only if no actual use (instantiation etc.)
of the construct appears in the program.

If such a use would appear in the program, a compiler diagnostic
is expected. However, designating a program as IFNDR means that
the compiler is relieved from the duty of producing any diagnostic
at all; see [intro.compliance.general] p2.

Thus, the carve-out is intended to keep requiring a diagnostic
if a use of the construct appears in the program, and otherwise
still call the program ill-formed, but not require a diagnostic
from the compiler.

For this case, I believe the intent is to exclude
constraint-expressions that are so weird that
compilers might not be able to represent them properly.

Jens

Received on 2025-02-25 21:28:35