This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl #80368] Fix implicit assignop in qq"a\U="
The bug report explains it all:
> $ perl -e 'print "a\U="'
> Can't modify constant item in concatenation (.) or string at -e line 1, near "print "a\U=""
> Execution of -e aborted due to compilation errors.
>
> The "a\U=" string constant ought to generate ops corresponding roughly to
> "a".uc("=") (which would then be constant-folded). However, the "=" is
> being interpreted by the tokeniser as part of the concatenation operator,
> producing ops corresponding to "a".=uc("") (which generates the error).
>
> This happens because the implicit concatenation operator is generated
> in toke.c via the Aop() macro, which allows an addition-type operator
> to be mutated into an assignment operator if it is immediately followed
> by an "=". It should instead be generated via one of the other macros,
> or possibly a new macro, that doesn't allow for mutation to an assignment
> operator.
This commit does the latter.
> There are multiple sites in toke.c making the same mistake.
The other two instances are harmless, but the next commit will change
them for a different reason (avoiding unnecessary PL_expect assign-
ments with a view to eventually removing PL_lex_expect).