Hello Uwe,
You're right. This is not explicitly stated in the standard. In infer
this for consistency's sake from the following paragraph in 15.3.
At the time of their use (e.g. in communication operations *send*,
*receive*, *call*, *getcall,* etc.), it is allowed to change template
fields by in-line modified templates, to pass in values via value
parameters as well as to pass in templates via template parameters. The
effects of these changes on the values of the template fields do not
persist in the template subsequent to the corresponding communication event.
Basically, for me, referencing a variable inside the template expression
is the same as passing it in as an implicit inout-parameter.
Of course, there is a difference to the case of non-parameterized
templates which can already be evaluated at definition time. Here, it
could be debated whether also the evaluation of the instance should be
deferred to the usage-time instead like for parameterized ones (which
would also lead to a different template every time the variable values
changed). But, templates without parameters are pretty much like
const-definitions and for const it does not make sense to defer the
evaluation of the right-hand-side until its usage (as that would negate
the const-ness in case the const refers to a variable on its right hand
side). Basically, a parameterized template is also a const-like
definition, but it only defines the (unchangeable) rule for
instantiation when given a set of parameters, i.e. at usage-time.
I agree, that in principle, the standard should be augmented to be more
explicit for these cases.
BR, Jacob Wieland