diff options
author | Richard Leach <richardleach@users.noreply.github.com> | 2021-05-11 21:04:45 +0100 |
---|---|---|
committer | Hugo van der Sanden <hv@crypt.org> | 2021-05-25 16:29:07 +0100 |
commit | 2583ef601d381a8a3e6e9b5f44db42bac0d537ab (patch) | |
tree | 327a1ed270b95c4064d01c30bbc9cc13ced53271 | |
parent | fd007c55e29f26e5df0f225a20f92972958d81f4 (diff) | |
download | perl-2583ef601d381a8a3e6e9b5f44db42bac0d537ab.tar.gz |
Make scalar assignment to undef a compile time error
-rw-r--r-- | op.c | 2 | ||||
-rw-r--r-- | t/run/fresh_perl.t | 4 |
2 files changed, 4 insertions, 2 deletions
@@ -4291,6 +4291,8 @@ Perl_op_lvalue_flags(pTHX_ OP *o, I32 type, U32 flags) switch (o->op_type) { case OP_UNDEF: + if (type == OP_SASSIGN) + goto nomod; PL_modcount++; goto do_next; diff --git a/t/run/fresh_perl.t b/t/run/fresh_perl.t index 5f0e2ce216..88a64ad583 100644 --- a/t/run/fresh_perl.t +++ b/t/run/fresh_perl.t @@ -194,8 +194,8 @@ BEGIN failed--compilation aborted at - line 1. ######## BEGIN { undef = 0 } EXPECT -Modification of a read-only value attempted at - line 1. -BEGIN failed--compilation aborted at - line 1. +Can't modify undef operator in scalar assignment at - line 1, near "0 }" +BEGIN not safe after errors--compilation aborted at - line 1. ######## { package foo; |