diff options
-rw-r--r-- | regcomp.c | 12 | ||||
-rw-r--r-- | t/pragma/warn/regcomp | 9 |
2 files changed, 12 insertions, 9 deletions
@@ -2820,12 +2820,12 @@ S_regpposixcc(pTHX_ I32 value) } break; } - if ((namedclass == OOB_NAMEDCLASS || - !(posixcc + skip + 2 < PL_regxend && - (posixcc[skip] == ':' && - posixcc[skip + 1] == ']')))) - Perl_croak(aTHX_ "Character class [:%.*s:] unknown", - t - s - 1, s + 1); + if (namedclass == OOB_NAMEDCLASS || + posixcc[skip] != ':' || + posixcc[skip+1] != ']') + Perl_croak(aTHX_ + "Character class [:%.*s:] unknown", + t - s - 1, s + 1); } else if (ckWARN(WARN_REGEXP) && !SIZE_ONLY) /* [[=foo=]] and [[.foo.]] are still future. */ Perl_warner(aTHX_ WARN_REGEXP, diff --git a/t/pragma/warn/regcomp b/t/pragma/warn/regcomp index 7d485f2efd..5de01c67d7 100644 --- a/t/pragma/warn/regcomp +++ b/t/pragma/warn/regcomp @@ -6,9 +6,11 @@ %.*s matches null string many times [S_regpiece] $a = "ABC123" ; $a =~ /(?=a)*/' - /%.127s/: Unrecognized escape \\%c passed through" [S_regatom] + /%.127s/: Unrecognized escape \\%c passed through [S_regatom] $x = '\m' ; /$x/ + Character class [:%.*s:] unknown [S_regpposixcc] + Character class syntax [. .] is reserved for future extensions [S_regpposixcc] Character class syntax [= =] is reserved for future extensions [S_checkposixcc] @@ -61,6 +63,7 @@ $_ = "" ; /[[.foo.]]/; /[[=bar=]]/; /[:zog:]/; +/[[:zog:]]/; no warnings 'regexp' ; /[:alpha:]/; /[.foo.]/; @@ -68,9 +71,9 @@ no warnings 'regexp' ; /[[:alpha:]]/; /[[.foo.]]/; /[[=bar=]]/; -/[:zog:]/; BEGIN { $ENV{PERL_DESTRUCT_LEVEL} = 0 unless $ENV{PERL_DESTRUCT_LEVEL} > 3 } /[[:zog:]]/; +/[:zog:]/; EXPECT Character class syntax [: :] belongs inside character classes at - line 4. Character class syntax [. .] belongs inside character classes at - line 5. @@ -80,7 +83,7 @@ Character class syntax [= =] is reserved for future extensions at - line 6. Character class syntax [. .] is reserved for future extensions at - line 8. Character class syntax [= =] is reserved for future extensions at - line 9. Character class syntax [: :] belongs inside character classes at - line 10. -Character class [:zog:] unknown at - line 20. +Character class [:zog:] unknown at - line 11. ######## # regcomp.c [S_regclass] $_ = ""; |