summaryrefslogtreecommitdiff
path: root/pad.c
diff options
context:
space:
mode:
authorJames E Keenan <jkeenan@cpan.org>2019-05-25 21:40:00 -0400
committerTony Cook <tony@develop-help.com>2019-10-02 14:59:31 +1000
commit30fc7a2809e5a175e2d9bb94d765b2039f270d91 (patch)
tree2323f07cd017b3484aa4ed1a8c06255b2cf90334 /pad.c
parente55ec392015ba0c575cf495206c3121d1989561b (diff)
downloadperl-30fc7a2809e5a175e2d9bb94d765b2039f270d91.tar.gz
Eliminate modifiable variables in constants
Transform previously deprecated cases into exceptions. Update diagnostic; change D to F remove now irrelevant code (TonyC) For: RT 134138
Diffstat (limited to 'pad.c')
-rw-r--r--pad.c22
1 files changed, 4 insertions, 18 deletions
diff --git a/pad.c b/pad.c
index c0098bedf3..7854678928 100644
--- a/pad.c
+++ b/pad.c
@@ -2127,7 +2127,6 @@ S_cv_clone_pad(pTHX_ CV *proto, CV *cv, CV *outside, HV *cloned,
* from the parent */
if (const_sv && SvREFCNT(const_sv) == 2) {
const bool was_method = cBOOL(CvMETHOD(cv));
- bool copied = FALSE;
if (outside) {
PADNAME * const pn =
PadlistNAMESARRAY(CvPADLIST(outside))
@@ -2156,28 +2155,15 @@ S_cv_clone_pad(pTHX_ CV *proto, CV *cv, CV *outside, HV *cloned,
) == o
&& !OpSIBLING(o))
{
- Perl_ck_warner_d(aTHX_
- packWARN(WARN_DEPRECATED),
- "Constants from lexical "
- "variables potentially "
- "modified elsewhere are "
- "deprecated. This will not "
- "be allowed in Perl 5.32");
- /* We *copy* the lexical variable, and donate the
- copy to newCONSTSUB. Yes, this is ugly, and
- should be killed. We need to do this for the
- time being, however, because turning on SvPADTMP
- on a lexical will have observable effects
- elsewhere. */
- const_sv = newSVsv(const_sv);
- copied = TRUE;
+ Perl_croak(aTHX_
+ "Constants from lexical variables potentially modified "
+ "elsewhere are no longer permitted");
}
else
goto constoff;
}
}
- if (!copied)
- SvREFCNT_inc_simple_void_NN(const_sv);
+ SvREFCNT_inc_simple_void_NN(const_sv);
/* If the lexical is not used elsewhere, it is safe to turn on
SvPADTMP, since it is only when it is used in lvalue con-
text that the difference is observable. */