$ perl -le' undef &{$x=sub{}}; $x->()'
Not a CODE reference at -e line 1.
undeffing an anonymous subroutine used to turn the ANON flag off,
causing it to bypass the condition apparently written for this situa-
tion in pp_entersub.
This commit stops cv_undef from turning off that flag, so now we get:
$ ./perl -le' undef &{$x=sub{}}; $x->()'
Undefined subroutine called at -e line 1.
CvXSUB(cv) = NULL;
}
/* delete all flags except WEAKOUTSIDE and CVGV_RC, which indicate the
- * ref status of CvOUTSIDE and CvGV */
- CvFLAGS(cv) &= (CVf_WEAKOUTSIDE|CVf_CVGV_RC);
+ * ref status of CvOUTSIDE and CvGV, and ANON, which pp_entersub uses
+ * to choose an error message */
+ CvFLAGS(cv) &= (CVf_WEAKOUTSIDE|CVf_CVGV_RC|CVf_ANON);
}
/*
print sub { return "ok 1\n" } -> ();
EXPECT
ok 1
+########
+# [perl #71154] undef &$code makes $code->() die with: Not a CODE reference
+undef &{$x=sub{}};
+$x->();
+EXPECT
+Undefined subroutine called at - line 3.