This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Remove compile-time checking of rv2?v with const kid
There was code in op.c:ck_rvconst (which runs when creating a derefer-
ence op, such as rv2sv, rv2av, etc.) that would check that a constant
kid holding a reference pointed to something of the right type. It
failed to take overloading into account.
The result was that these lines would fail to compile:
constant_reference_to_hash_with_coderef_overloading->();
constant_reference_to_sub_with_hashref_overloading->{key};
constant_reference_to_sub_with_arrayref_overloading->[0];
constant_reference_to_sub_with_scalarref_overloading->$*;
even though they should work.
Since the overloadedness could change any time, even checking for that
in op.c is incorrect. The only correct fix is to remove this compile-
time check. If something naughty gets through, it will be caught
at run time.
This fixes bugs #122607 and #69456.