This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
signature sub (\x80 triggered an assertion
authorDavid Mitchell <davem@iabyn.com>
Mon, 30 Jan 2017 12:25:55 +0000 (12:25 +0000)
committerDavid Mitchell <davem@iabyn.com>
Mon, 30 Jan 2017 12:30:30 +0000 (12:30 +0000)
RT #130661

In the presence of 'use feature "signatures"', a char >= 0x80 where a sigil
was expected triggered an assert failure, because the (signed) character
was being was being promoted to int and ended up getting returned from
yylex() as a negative value.

t/op/signatures.t
toke.c

index 0e53bf0..aa785bf 100644 (file)
@@ -1463,6 +1463,12 @@ is scalar(t145()), undef;
             "masking warning";
 }
 
+# RT #130661 a char >= 0x80 in a signature when a sigil was expected
+# was triggering an assertion
+
+eval "sub (\x80";
+like $@, qr/A signature parameter must start with/, "RT #130661";
+
 
 
 use File::Spec::Functions;
diff --git a/toke.c b/toke.c
index 10ee500..7dcdd5a 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -5037,7 +5037,7 @@ Perl_yylex(pTHX)
          * as a var; e.g. ($, ...) would be seen as the var '$,'
          */
 
-        char sigil;
+        U8 sigil;
 
         s = skipspace(s);
         sigil = *s++;