This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
enforce strict for barewords in multiconcat
authorTony Cook <tony@develop-help.com>
Mon, 4 Nov 2019 21:00:25 +0000 (08:00 +1100)
committerTony Cook <tony@develop-help.com>
Mon, 4 Nov 2019 22:36:13 +0000 (23:36 +0100)
gh #17254

op.c
t/lib/strict/subs

diff --git a/op.c b/op.c
index 0d1ac32..e2ae1a2 100644 (file)
--- 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++;
index a83df01..1aa7c5c 100644 (file)
@@ -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.