From: Michael G. Schwern Date: Mon, 21 Jan 2002 15:22:54 +0000 (-0500) Subject: [BUG] /\_/ an unrecognized escape? X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=707afd922f953b906fb39ee9de6af3d448931188;p=p5sagit%2Fp5-mst-13.2.git [BUG] /\_/ an unrecognized escape? Message-ID: <20020121202254.GA6731@blackrider> p4raw-id: //depot/perl@14371 --- diff --git a/t/lib/warnings/toke b/t/lib/warnings/toke index 70ff3db..01e31f8 100644 --- a/t/lib/warnings/toke +++ b/t/lib/warnings/toke @@ -727,3 +727,14 @@ no warnings 'ambiguous'; "@mjd_previously_unused_array"; EXPECT Possible unintended interpolation of @mjd_previously_unused_array in string at - line 3. +######## +# toke.c +# The \q should warn, the \_ should NOT warn. +use warnings 'misc'; +"foo" =~ /\q/; +"bar" =~ /\_/; +no warnings 'misc'; +"foo" =~ /\q/; +"bar" =~ /\_/; +EXPECT +Unrecognized escape \q passed through at - line 4. diff --git a/toke.c b/toke.c index 6528ef4..2413a68 100644 --- a/toke.c +++ b/toke.c @@ -1424,7 +1424,9 @@ S_scan_const(pTHX_ char *start) /* FALL THROUGH */ default: { - if (ckWARN(WARN_MISC) && isALNUM(*s)) + if (ckWARN(WARN_MISC) && + isALNUM(*s) && + *s != '_') Perl_warner(aTHX_ WARN_MISC, "Unrecognized escape \\%c passed through", *s);