Otherwise bless $tied_ref will die if FETCH hasn’t been called else-
where yet.
PERL_ARGS_ASSERT_SV_BLESS;
+ SvGETMAGIC(sv);
if (!SvROK(sv))
Perl_croak(aTHX_ "Can't bless non-reference value");
tmpRef = SvRV(sv);
require './test.pl';
}
-plan (111);
+plan (112);
sub expected {
my($object, $package, $type) = @_;
like $@, qr/^Modification of a read-only value attempted/,
'read-only COWs cannot be blessed';
}
+
+sub TIESCALAR { bless \(my $thing = pop), shift }
+sub FETCH { ${$_[0]} }
+tie $tied, main => $untied = [];
+eval { bless $tied };
+is ref $untied, "main", 'blessing through tied refs' or diag $@;