p4raw-id: //depot/perl@22625
no_bareword_allowed(first);
else if (ckWARN(WARN_BAREWORD) && (first->op_private & OPpCONST_BARE))
Perl_warner(aTHX_ packWARN(WARN_BAREWORD), "Bareword found in conditional");
- if ((type == OP_AND) == (SvTRUE(((SVOP*)first)->op_sv))) {
+ if ((type == OP_AND && SvTRUE(((SVOP*)first)->op_sv)) ||
+ (type == OP_OR && !SvTRUE(((SVOP*)first)->op_sv)) ||
+ (type == OP_DOR && !SvOK(((SVOP*)first)->op_sv))) {
op_free(first);
*firstp = Nullop;
other->op_private |= OPpCONST_SHORTCIRCUIT;
package main;
require './test.pl';
-plan( tests => 30 );
+plan( tests => 33 );
my($x);
is( $@, '' );
eval q# sub { print $fh /2 } #;
like( $@, qr/^Search pattern not terminated/ );
+
+# [perl #28123] Perl optimizes // away incorrectly
+
+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');