(void)((cv = cvp[off=bool__amg])
|| (cv = cvp[off=numer_amg])
|| (cv = cvp[off=string_amg]));
- postpr = 1;
+ if (cv)
+ postpr = 1;
break;
case copy_amg:
{
case ge_amg:
case eq_amg:
case ne_amg:
- postpr = 1; off=ncmp_amg; break;
+ off = ncmp_amg;
+ break;
case slt_amg:
case sle_amg:
case sgt_amg:
case sge_amg:
case seq_amg:
case sne_amg:
- postpr = 1; off=scmp_amg; break;
+ off = scmp_amg;
+ break;
}
- if (off != -1) cv = cvp[off];
- if (!cv) {
- goto not_found;
- }
+ if ((off != -1) && (cv = cvp[off]))
+ postpr = 1;
+ else
+ goto not_found;
} else {
not_found: /* No method found, either report or croak */
switch (method) {
- case lt_amg:
- case le_amg:
- case gt_amg:
- case ge_amg:
- case eq_amg:
- case ne_amg:
- case slt_amg:
- case sle_amg:
- case sgt_amg:
- case sge_amg:
- case seq_amg:
- case sne_amg:
- postpr = 0; break;
case to_sv_amg:
case to_av_amg:
case to_hv_amg:
package main;
$| = 1;
-use Test::More tests => 605;
+use Test::More tests => 607;
$a = new Oscalar "087";
}
{
- # comparison operators with nomethod
+ # comparison operators with nomethod (bug 41546)
my $warning = "";
my $method;
}
{
+ # nomethod called for '!' after attempted fallback
+ my $nomethod_called = 0;
+
+ package nomethod_not;
+ use overload nomethod => sub { $nomethod_called = 'yes'; };
+
+ package main;
+ my $o = bless [], 'nomethod_not';
+ my $res = ! $o;
+
+ is($nomethod_called, 'yes', "nomethod() is called for '!'");
+ is($res, 'yes', "nomethod(..., '!') return value propagates");
+}
+
+{
# Subtle bug pre 5.10, as a side effect of the overloading flag being
# stored on the reference rather than the referent. Despite the fact that
# objects can only be accessed via references (even internally), the