When a nameref local to a higher function scope points to a variable in the temporary environment, that nameref (correctly, it seems) expands to the value of the target variable from the temporary environment. However, assignment to the nameref modifies the variable from the higher scope, bypassing the tempenv:
$ a() { local -n ref=var; var=tmp b; echo $ref; } $ b() { ref=$ref; } $ var=foo; a tmp