You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A constrained alias templates constraints are not checked when the arguments are dependent. However, the alias is substituted at the point of use, before instantiation.
template<C T> using X = const T;
template<typename T>
void f(T x) {
X<T> y = x; // Potentially ill-formed
}
There are several ways an implementer might be able to check constraints:
Require that constrained alias templates not be substituted on use. This is probably a non-starter.
Propagate the constraints as part of the resulting type, basically inventing a new kind of "constrained type" that is valid only if the constraints are satsifed
Do not check the constraints
Morally, the alias should not be used if its constraints are not subsumed by the constraints of the surrounding context since instantiation could lead to substitution failures. This is effectively the same as separate checking, which is most definitely not required by concepts lite.
The text was updated successfully, but these errors were encountered:
A constrained alias templates constraints are not checked when the arguments are dependent. However, the alias is substituted at the point of use, before instantiation.
There are several ways an implementer might be able to check constraints:
Morally, the alias should not be used if its constraints are not subsumed by the constraints of the surrounding context since instantiation could lead to substitution failures. This is effectively the same as separate checking, which is most definitely not required by concepts lite.
The text was updated successfully, but these errors were encountered: