Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: "unset -n" removes nameref-ness



On Sun, Jun 8, 2025 at 5:28 PM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
>
> typeset -n ref=var
> unset -n ref
>
> think this is actually a bug -- "unset -n ref" should cause ref
> to cease to be a named reference at all, as explained by this bit of
> doc
diff --git a/Src/builtin.c b/Src/builtin.c
index 5563bdba9..3a290e5c8 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -3970,7 +3970,8 @@ bin_unset(char *name, char **argv, Options ops, int func)
 		    pm->node.flags |= PM_DECLARED;
 		    continue;
 		}
-	    }
+	    } else /* should this be in unsetparam_pm()? */
+		pm->node.flags &= ~PM_NAMEREF;
 	    if (unsetparam_pm(pm, 0, 1))
 		returnval = 1;
 	}


Messages sorted by: Reverse Date, Date, Thread, Author