I think there's a related regression in the latest devel commit. Creating a
local variable with the same name as a higher-scoped nameref pointing to an
unset variable creates a local variable with the name of the target of the
nameref.

Starting with:

    declare -n ref=var
    f() { local ref=Y; declare -p ref var; local; }

This still works fine in both latest and previous:

    $ var=X; f
    declare -- ref="Y"
    declare -- var="X"
    ref=Y

But the behavior in the unset target case changed from the expected:

    $ unset var; f
    declare -- ref="Y"
    bash: declare: var: not found
    ref=Y

to:

    $ unset var; f
    declare -n ref="var"
    declare -- var="Y"
    var=Y

Reply via email to