From: Tony Cook Date: Mon, 4 Nov 2019 21:00:25 +0000 (+1100) Subject: enforce strict for barewords in multiconcat X-Git-Tag: v5.31.6~169 X-Git-Url: https://perl5.git.perl.org/perl5.git/commitdiff_plain/a6d5b8290f10eb709eb405ee94145c9620f8e5a2 enforce strict for barewords in multiconcat gh #17254 --- diff --git a/op.c b/op.c index 0d1ac32..e2ae1a2 100644 --- a/op.c +++ b/op.c @@ -3118,6 +3118,8 @@ S_maybe_multiconcat(pTHX_ OP *o) && (SvPOK(sv) || SvIOK(sv)) && (!SvGMAGICAL(sv)) ) { + if (argop->op_private & OPpCONST_STRICT) + no_bareword_allowed(argop); argp++->p = sv; utf8 |= cBOOL(SvUTF8(sv)); nconst++; diff --git a/t/lib/strict/subs b/t/lib/strict/subs index a83df01..1aa7c5c 100644 --- a/t/lib/strict/subs +++ b/t/lib/strict/subs @@ -475,3 +475,11 @@ my $y = !BARE2; EXPECT Bareword "BARE2" not allowed while "strict subs" in use at - line 3. Execution of - aborted due to compilation errors. +######## +# NAME multiconcat and barewords gh #17254 +use strict; +sub foo { "foo" } +print foo() . SLASH . "bar"; +EXPECT +Bareword "SLASH" not allowed while "strict subs" in use at - line 3. +Execution of - aborted due to compilation errors.