Subject: | accessor behaves as lvalue_accessor on perl 5.16.1 -Dusethreads |
On v5.16.1 built for i686-linux-thread-multi
perl -E 'use Class::XSAccessor constructor => "new", accessors => {foo => "foo"}; my $obj = main->new; $obj->foo(1); $obj->foo = 42; say $obj->foo'
# 42
On v5.14.2 built for i686-linux-gnu-thread-multi-64int the same cde behaves as expected:
# Can't modify non-lvalue subroutine call at -e line 1.
$? == 255
I'm not sure I can track what causes the problem, but possible fix I can see atm:
Add the following check in *_init functions before CXAH_OPTIMIZE_ENTERSUB(...) call:
if (PL_op->op_flags & OPf_MOD || LVRET)
DIE(aTHX_ "Can't modify non-lvalue subroutine call");
I'm not sure if -Dusethreads affects anything or it's just 5.16.1 issue.