This might have the same fix. I guess Bash only checks for valid variable names during expansion or initial assignment.
$ bash -xc 'typeset -n x; x=@ x=(ha ha); typeset -p @' + typeset -n x + x=@ + x=(ha ha) + typeset -p @ declare -a @='([0]="ha" [1]="ha")' Bash eventually catches it if you try using the variable so the harm is minimal. I suppose you could wreck things for somebody evaluating the output. $ typeset -n x; x="_; y" x=foo; typeset -p "${!x}"; eval "$(typeset -p "${!x}")"; echo "$y" + typeset -n x + x='_; y' + x=foo + typeset -p '_; y' declare -- _; y="foo" ++ typeset -p '_; y' + eval 'declare -- _; y="foo"' ++ declare -- _ ++ y=foo + echo foo foo -- Dan Douglas