summaryrefslogtreecommitdiff
path: root/lang/perl5.14/files/patch-bug49472
blob: afc02952ba56763e4b3e741790bc085b5e72d56d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# http://rt.perl.org/rt3/Public/Bug/Display.html?id=49472
# http://perl5.git.perl.org/perl.git/commitdiff/ca4cfd28534303b82a216cfe83a1c80cbc3b9dc5?hp=41d86c6b932c287037db3584f7658c067cae5e84
diff --git a/t/comp/require.t b/t/comp/require.t
index af5e4b2..0746b3b 100755
--- t/comp/require.t
+++ t/comp/require.t
@@ -15,7 +15,7 @@ krunch.pm krunch.pmc whap.pm whap.pmc);
 
 my $Is_EBCDIC = (ord('A') == 193) ? 1 : 0;
 my $Is_UTF8   = (${^OPEN} || "") =~ /:utf8/;
-my $total_tests = 49;
+my $total_tests = 50;
 if ($Is_EBCDIC || $Is_UTF8) { $total_tests -= 3; }
 print "1..$total_tests\n";
 
@@ -258,6 +258,20 @@ EOT
     }
 }
 
+#  [perl #49472] Attributes + Unkown Error
+
+{
+    do_require
+	'use strict;sub MODIFY_CODE_ATTRIBUTE{} sub f:Blah {$nosuchvar}';
+    my $err = $@;
+    $err .= "\n" unless $err =~ /\n$/;
+    unless ($err =~ /Global symbol "\$nosuchvar" requires /) {
+	$err =~ s/^/# /mg;
+	print "${err}not ";
+    }
+    print "ok ", ++$i, " [perl #49472]\n";
+}
+
 ##########################################
 # What follows are UTF-8 specific tests. #
 # Add generic tests before this point.   #
diff --git a/toke.c b/toke.c
index 2ae8b75..ecee902 100644
--- toke.c
+++ toke.c
@@ -692,6 +692,7 @@ Perl_lex_start(pTHX_ SV *line, PerlIO *rsfp, bool new_filter)
 #else
     parser->nexttoke = 0;
 #endif
+    parser->error_count = oparser ? oparser->error_count : 0;
     parser->copline = NOLINE;
     parser->lex_state = LEX_NORMAL;
     parser->expect = XSTATE;