+
+my $wiz3 = wizard store => sub { ++$_[2]; 0 };
+my %h3 = (a => 3);
+cast %h3, $wiz3;
+
+for my $i (1 .. 2) {
+ eval { my $key = 'a'; $h3{$key} = 3 + $i };
+ is $@, '', "uvar: change key in store doesn't croak ($i)";
+ is_deeply \%h3, { a => 3, b => 3 + $i },
+ "uvar: change key in store correcty ($i)";
+}
+
+my $ro_bare_hk = $] >= 5.010 && $Config{useithreads};
+diag 'This perl has readonly bare hash keys' if $ro_bare_hk;
+
+for my $i (1 .. 2) {
+ eval { $h3{b} = 5 + $i };
+ if ($ro_bare_hk) {
+ like $@, qr/Modification\s+of\s+a\s+read-only\s+value/,
+ "uvar: change readonly key in store croaks ($i)";
+ is_deeply \%h3, { a => 3, b => 5 },
+ "uvar: change readonly key in store correcty ($i)";
+ } else {
+ is $@, '', "uvar: change readonly key in store croaks ($i)";
+ is_deeply \%h3, { a => 3, b => 5, c => 6, (d => 7) x ($i >= 2) },
+ "uvar: change readonly key in store correcty ($i)";
+ }
+}
+