Commit | Line | Data |
---|---|---|
a9f6cb1f A |
1 | #!./perl |
2 | ||
3 | use strict; | |
4 | use warnings; | |
5 | no warnings 'syntax'; | |
6 | ||
7 | BEGIN { | |
8 | chdir 't' if -d 't'; | |
9 | @INC = '../lib'; | |
10 | } | |
11 | ||
12 | sub is; | |
13 | sub plan; | |
14 | ||
15 | require './test.pl'; | |
16 | plan tests => 3; | |
17 | ||
18 | { | |
19 | # Bug #77084 points out a corruption problem when scalar //g is used | |
20 | # on overloaded objects. | |
21 | ||
f427b557 | 22 | my @realloc; |
a9f6cb1f A |
23 | my $TAG = "foo:bar"; |
24 | use overload '""' => sub {$TAG}; | |
25 | ||
26 | my $o = bless []; | |
27 | my ($one) = $o =~ /(.*)/g; | |
f427b557 | 28 | push @realloc, "xxxxxx"; # encourage realloc of SV and PVX |
a9f6cb1f A |
29 | is $one, $TAG, "list context //g against overloaded object"; |
30 | ||
a9f6cb1f A |
31 | |
32 | my $r = $o =~ /(.*)/g; | |
f427b557 | 33 | push @realloc, "yyyyyy"; # encourage realloc of SV and PVX |
a9f6cb1f A |
34 | is $1, $TAG, "scalar context //g against overloaded object"; |
35 | ||
f427b557 DM |
36 | local our $TODO = "Bug #77084"; |
37 | ||
a9f6cb1f | 38 | $o =~ /(.*)/g; |
f427b557 | 39 | push @realloc, "zzzzzz"; # encourage realloc of SV and PVX |
a9f6cb1f A |
40 | is $1, $TAG, "void context //g against overloaded object"; |
41 | } | |
42 | ||
43 | ||
44 | __END__ |