In the latest devel this issue is fixed for the case that the local nameref points to a non-existent variable but there is still a bug if the variable pointed to by a local nameref already exists. In such a case, `declare' commands after the initial `declare -n' end up modifying the value and/or attributes of the local nameref variable itself rather than modifying the target of the nameref.
At global scope: unset -n ref; unset var declare var=X; declare -n ref=var; declare ref=(Y); declare -p ref var declare -n ref="var" declare -a var=([0]="Y") Whereas in a function: unset -n ref; unset var f() { declare var=X; declare -n ref=var; declare ref=(Y); declare -p ref var }; f declare -an ref=([0]="Y") declare -- var="X"