[BUG] /\_/ an unrecognized escape?
Michael G. Schwern [Mon, 21 Jan 2002 15:22:54 +0000 (10:22 -0500)]
Message-ID: <20020121202254.GA6731@blackrider>

p4raw-id: //depot/perl@14371

t/lib/warnings/toke
toke.c

index 70ff3db..01e31f8 100644 (file)
@@ -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 (file)
--- 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);