Now BEGIN blocks, etc., are called in void context, so the result of
evaluating the last statement is not wastefully copied.
#define CALL_LIST_BODY(cv) \
PUSHMARK(PL_stack_sp); \
- call_sv(MUTABLE_SV((cv)), G_EVAL|G_DISCARD);
+ call_sv(MUTABLE_SV((cv)), G_EVAL|G_DISCARD|G_VOID);
static void
S_init_tls_and_interp(PerlInterpreter *my_perl)
require './test.pl';
}
-plan tests => 5;
+plan tests => 6;
my @expect = qw(
b1
# [perl #78634] Make sure block names can be used as constants.
use constant INIT => 5;
::is INIT, 5, 'constant named after a special block';
+
+# [perl #108794] context
+fresh_perl_is(<<'SCRIPT3', <<expEct,{stderr => 1 },'context');
+sub context {
+ print qw[void scalar list][wantarray + defined wantarray], "\n"
+}
+BEGIN {context}
+UNITCHECK {context}
+CHECK {context}
+INIT {context}
+END {context}
+SCRIPT3
+void
+void
+void
+void
+void
+expEct