summaryrefslogtreecommitdiff
path: root/t/op/lvref.t
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2014-10-01 20:18:06 -0700
committerFather Chrysostomos <sprout@cpan.org>2014-10-11 00:10:15 -0700
commit63702de8ecadcbe5560b2c7c53440a93e87809d0 (patch)
treef1c42bc82b5ca34e3109c8c5042439e549642812 /t/op/lvref.t
parent408e9044cd5472e7fb56dd6bde4c00dca3db5d10 (diff)
downloadperl-63702de8ecadcbe5560b2c7c53440a93e87809d0.tar.gz
Fix err message for $cond ? \bad : ... = ...
The error message code in S_lvref was assuming that it only handled list assignment (which was originally the case), but $condition ? \pos : whatever = ... goes through that same code path, and that is a scalar assignment. So pass the assignment type through to S_lvref.
Diffstat (limited to 't/op/lvref.t')
-rw-r--r--t/op/lvref.t6
1 files changed, 5 insertions, 1 deletions
diff --git a/t/op/lvref.t b/t/op/lvref.t
index bfdd737782..bdaa23e7e8 100644
--- a/t/op/lvref.t
+++ b/t/op/lvref.t
@@ -4,7 +4,7 @@ BEGIN {
set_up_inc("../lib");
}
-plan 124;
+plan 125;
sub on { $::TODO = ' ' }
sub off{ $::TODO = '' }
@@ -424,6 +424,10 @@ eval '\%{"42"} = 42';
like $@,
qr/^Can't modify reference to hash dereference in scalar assignment a/,
"Can't modify reference to hash dereference in scalar assignment";
+eval '$foo ? \%{"42"} : \%43 = 42';
+like $@,
+ qr/^Can't modify reference to hash dereference in scalar assignment a/,
+ "Can't modify ref to whatever in scalar assignment via cond expr";
on;