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
If a function template f is called in a way that requires a default argument to be used, the dependent names are looked up, the semantics constraints are checked, and the instantiation of any template used in the default argument is done as if the default argument had been an initializer used in a function template specialization with the same scope, the same template parameters and the same access as that of the function template f used at that point, except that the scope in which a closure type is declared ([expr.prim.lambda.closure]) – and therefore its associated namespaces – remain as determined from the context of the definition for the default argument.
What does "in a function template specialization" mean? Does it mean in the fiction declaration of the specialization or in the fiction body of the specialization? CWG1664 implies the meaning should be latter
A possibility, then, is that the closure type for a lambda expression in a default argument for a template function (or, presumably, a member function of a class template) is to be considered as having been declared in some block scope in the body of the fictional function template specialization.
The improvement might be
If a specialization of a function template f is called in a way that requires a default argument to be used, the dependent names are looked up, the semantics constraints are checked, and the instantiation of any template used in the default argument is done as if the default argument had been an initializer of an invented variable that inhabits the block scope associated with that of the body of f that is introduced by the function template specialization([basic.scope.scope] p7), where the function template specialization has the same scope, the same template parameters and the same access as that of the function template f used at that point. except that the scope in which a closure type is declared ([expr.prim.lambda.closure]) – and therefore its associated namespaces – remain as determined from the context of the definition for the default argument.
[basic.scope.scope] p7 says
When instantiating a templated entity ([temp.pre]), any scope S introduced by any part of the template definition is considered to be introduced by the instantiated entity and to contain the instantiations of any declarations that inhabit S.
The part of the except... is not necessary, since the innermost enclosing namespace of a local class is that of the function in which the local class is declared.
The text was updated successfully, but these errors were encountered:
[temp.inst] p12 says
What does "in a function template specialization" mean? Does it mean in the fiction declaration of the specialization or in the fiction body of the specialization? CWG1664 implies the meaning should be latter
The improvement might be
[basic.scope.scope] p7 says
The part of the
except...
is not necessary, since the innermost enclosing namespace of a local class is that of the function in which the local class is declared.The text was updated successfully, but these errors were encountered: