summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2016-09-28 13:40:34 +0100
committerDavid Mitchell <davem@iabyn.com>2016-09-28 13:40:34 +0100
commit614f2ce4f49414577dec90f8c9bd3f0404bf2ebf (patch)
tree944558caf200f53eea7a8c479d62183676a6dc48 /sv.c
parent81b96c32839f3fa3ae70bddf441b4e6827eb93c8 (diff)
downloadperl-614f2ce4f49414577dec90f8c9bd3f0404bf2ebf.tar.gz
undef $0 shouldn't warn about $0
RT #123910 $ perl -we'undef $0' Use of uninitialized value $0 in undef operator at -e line 1. Generally, undef should ignore its arg when determining which var was undef: only magic will trigger an undef warning.
Diffstat (limited to 'sv.c')
-rw-r--r--sv.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sv.c b/sv.c
index 088359f62d..dd0b3d456a 100644
--- a/sv.c
+++ b/sv.c
@@ -15823,6 +15823,11 @@ S_find_uninit_var(pTHX_ const OP *const obase, const SV *const uninit_sv,
switch (obase->op_type) {
+ case OP_UNDEF:
+ /* undef should care if its args are undef - any warnings
+ * will be from tied/magic vars */
+ break;
+
case OP_RV2AV:
case OP_RV2HV:
case OP_PADAV:
@@ -16369,7 +16374,6 @@ S_find_uninit_var(pTHX_ const OP *const obase, const SV *const uninit_sv,
case OP_ALARM:
case OP_SEMGET:
case OP_GETLOGIN:
- case OP_UNDEF:
case OP_SUBSTR:
case OP_AEACH:
case OP_EACH: