package main;
require './test.pl';
-plan( tests => 35 );
+plan( tests => 41 );
my($x);
is(0 // 2, 0, ' // : left-hand operand not optimized away');
is('' // 2, '', ' // : left-hand operand not optimized away');
is(undef // 2, 2, ' // : left-hand operand optimized away');
+
+# [perl #32347] err should be a weak keyword
+
+package weakerr;
+
+sub err { "<@_>" }
+::is( (shift() err 42), 42, 'err as an operator' );
+::is( (shift err 42), 42, 'err as an operator, with ambiguity' );
+::is( (err 2), "<2>", 'err as a function without parens' );
+::is( err(2, 3), "<2 3>", 'err as a function with parens' );
+::is( err(), "<>", 'err as a function without arguments' );
+::is( err, "<>", 'err as a function without parens' );
{
tmp = 0; /* any sub overrides "weak" keyword */
}
+ else if (gv && !gvp
+ && tmp == -KEY_err
+ && GvCVu(gv)
+ && PL_expect != XOPERATOR
+ && PL_expect != XTERMORDORDOR)
+ {
+ /* any sub overrides the "err" keyword, except when really an
+ * operator is expected */
+ tmp = 0;
+ }
else { /* no override */
tmp = -tmp;
if (tmp == KEY_dump && ckWARN(WARN_MISC)) {