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 couple of editorial cleanups would seem nice post-CWG2672:
In the writeup of CWG2672, I suggested: "[...] move the rule somewhere more general", which has not happened. The general rule that substitution into a lambda-expression considers the body to not be in the immediate context, which applies to all substitutions, is still in [temp.deduct.general], the section on template argument deduction.
The example in [temp.deduct.general]/9, immediately after the normative wording changed by that issue, doesn't match the rule. Prior to CWG2672, the rule was that all substitution into a lambda-expression during template argument deduction was not in the immediate context, and afterwards, the rule is that only substitution into the body is in the immediate context (but it doesn't matter if we're doing template argument deduction or something else). In particular, the h example is now valid:
template <classT>
autoh(T) -> decltype([x = T::invalid]() { });
voidh(...);
h(0); // error: invalid expression not part of the immediate context
... should presumably say something like OK; invalid expression is in the immediate context.
The text was updated successfully, but these errors were encountered:
template <classT, std::size_t = sizeof([]() { T::invalid; })>
voidg(T);
voidg(...);
g(0); // error: invalid expression not part of the immediate context
The example suggests that the body of lambda expression is instantiated, which results in hard error (implementations agree).
However, given the lambda expression is not called and return type deduction shouldn't happen, is there anything requiring instantiation of the lambda body?
It seems that the lambda body needs to be substituted into but the member operator() (or the similar function pointed to by the result of conversion function) isn't instantiated. This is perhaps fine but looks a bit inconsistent to me.
A couple of editorial cleanups would seem nice post-CWG2672:
In the writeup of CWG2672, I suggested: "[...] move the rule somewhere more general", which has not happened. The general rule that substitution into a lambda-expression considers the body to not be in the immediate context, which applies to all substitutions, is still in [temp.deduct.general], the section on template argument deduction.
The example in [temp.deduct.general]/9, immediately after the normative wording changed by that issue, doesn't match the rule. Prior to CWG2672, the rule was that all substitution into a lambda-expression during template argument deduction was not in the immediate context, and afterwards, the rule is that only substitution into the body is in the immediate context (but it doesn't matter if we're doing template argument deduction or something else). In particular, the
h
example is now valid:... should presumably say something like
OK; invalid expression is in the immediate context
.The text was updated successfully, but these errors were encountered: