'Assignment should not ignore magic when the last thing assigned was a glob');
expected_tie_calls(tied $c, 1, 1);
+# autovivication of aelem, helem, of rv2sv combined with get-magic
+{
+ my $true = 1;
+ my $s;
+ tie $$s, "Tie::Monitor";
+ $$s = undef;
+ $$s->[0] = 73;
+ is($$s->[0], 73);
+ expected_tie_calls(tied $$s, 2, 2);
+
+ my @a;
+ tie $a[0], "Tie::Monitor";
+ $a[0] = undef;
+ $a[0][0] = 73;
+ is($a[0][0], 73);
+ expected_tie_calls(tied $a[0], 2, 2);
+
+ my %h;
+ tie $h{foo}, "Tie::Monitor";
+ $h{foo} = undef;
+ $h{foo}{bar} = 73;
+ is($h{foo}{bar}, 73);
+ expected_tie_calls(tied $h{foo}, 2, 2);
+
+ # Similar tests, but with obscured autovivication by using dummy list or "?:" operator
+ {
+ local our $TODO = "Get magic is executed too often";
+ $$s = undef;
+ ${ (), $$s }[0] = 73;
+ is( $$s->[0], 73);
+ expected_tie_calls(tied $$s, 2, 2);
+ }
+
+ $$s = undef;
+ ( ! $true ? undef : $$s )->[0] = 73;
+ is( $$s->[0], 73);
+ expected_tie_calls(tied $$s, 2, 2);
+
+ {
+ local our $TODO = "Get magic is executed too often";
+ $$s = undef;
+ ( $true ? $$s : undef )->[0] = 73;
+ is( $$s->[0], 73);
+ expected_tie_calls(tied $$s, 2, 2);
+ }
+
+}
+
# A plain *foo should not call get-magic on *foo.
# This method of scalar-tying an immutable glob relies on details of the
# current implementation that are subject to change. This test may need to