On 30 Apr 2016, at 22:24, Grisha Levit wrote: > I just re-built bash-20160415 snapshot and am observing the same behavior. > To clarify, the first case is the unexpected one -- shouldn't `declare -n > ref=var; declare -n ref' be a no-op, no matter if $var is set or not? It is > a no-op when in global scope, but not inside a function.
I rebuilt just now, both on mac os x 10.6 and on linux i686, I cannot reproduce it: $ f() { unset var; declare -n ref=var; declare -n ref; declare -p ref; }; f declare -n ref $ echo $BASH_VERSION 4.4.0(1)-rc2 $ git log -1 | head -1 commit 3475994a81ce49cf3a50b6ceeb5ad719986aa5f4 could you share your environment, platform, etc? I also debugged unset_builtin, it does some unnecessary calls for no existent variables, but nothing that would justify this behaviour. pg