Skip to content

Commit f69a90f

Browse files
1-1samkhwilliamson
authored andcommitted
Add tests for GH 15545 (my sub using our sub segfaults)
1 parent 68c0abd commit f69a90f

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

t/op/lexsub.t

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ BEGIN {
88
*bar::like = *like;
99
}
1010

11-
plan 156;
11+
plan 158;
1212

1313
# -------------------- our -------------------- #
1414

@@ -115,6 +115,24 @@ our sub foo;
115115
print "ok";
116116
PROG
117117

118+
# https://github.com/Perl/perl5/issues/15545
119+
fresh_perl(<<'PROG', {});
120+
our sub speak {}
121+
my sub meow {
122+
speak();
123+
}
124+
PROG
125+
is $?, 0, 'referencing our sub from closure sub does not crash; GH 15545';
126+
fresh_perl(<<'PROG', {});
127+
our sub speak {}
128+
package Cat {
129+
my sub meow {
130+
speak();
131+
}
132+
}
133+
PROG
134+
is $?, 0, 'referencing our sub from closure sub in seperate package does not crash; GH 15545';
135+
118136
# -------------------- state -------------------- #
119137

120138
use feature 'state'; # state

0 commit comments

Comments
 (0)