The substitution of template arguments into a
requires-expression
may result in the formation of invalid types or expressions in its
requirements or the violation of the semantic constraints of those
requirements. In such cases, the
requires-expression evaluates to
false;
it does not cause the program to be ill-formed
. The substitution and semantic constraint checking
proceeds in lexical order and stops when a condition that
determines the result of the
requires-expression is encountered
. If substitution (if any) and semantic constraint checking succeed,
the
requires-expression evaluates to
true. [
Note 1:
If a
requires-expression contains invalid types or expressions in
its
requirements, and it does not appear within the declaration of a templated
entity, then the program is ill-formed
. —
end note]
If the substitution of template arguments into a
requirement
would always result in a substitution failure, the program is ill-formed;
no diagnostic required
. [
Example 3:
template<typename T> concept C =
requires {
new int[-(int)sizeof(T)];
};
—
end example]