diff options
author | Rick Delaney <rick@consumercontact.com> | 2003-01-01 17:54:59 -0500 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2003-09-18 19:15:07 +0000 |
commit | 29ddfe354327d85ef66e9723b006d41eb553cd25 (patch) | |
tree | 249aeaf66eb16205c4a8528f9c8589ebf8f70258 /lib/overload.t | |
parent | d1bddb8e6a8a26e4cebf65fd8f44b156b4784f23 (diff) | |
download | perl-29ddfe354327d85ef66e9723b006d41eb553cd25.tar.gz |
Re: [perl #19582] [PATCH bleedperl] bad overload copy constructor segfaults
Message-ID: <20030101225459.A2320@cs839290-a.mtth.phub.net.cable.rogers.com>
(Pity the first patch fell through the cracks back then.
Not that forbidding non-object copy constructors is the right
thing to do but the bug could use fixing.)
p4raw-id: //depot/perl@21276
Diffstat (limited to 'lib/overload.t')
-rw-r--r-- | lib/overload.t | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/lib/overload.t b/lib/overload.t index 0aba79f423..3490b5bf6a 100644 --- a/lib/overload.t +++ b/lib/overload.t @@ -1087,5 +1087,21 @@ print $@ =~ /zap/ ? "ok 227\n" : "not ok 227\n"; print overload::StrVal(qr/a/) =~ /^Regexp=SCALAR\(0x[0-9a-f]+\)$/ ? "ok 228\n" : "not ok 228\n"; +{ + package t229; + use overload '=' => sub { 42 }, + '++' => sub { my $x = ${$_[0]}; $_[0] }; + sub new { my $x = 42; bless \$x } + + my $warn; + { + local $SIG{__WARN__} = sub { $warn++ }; + my $x = t229->new; + my $y = $x; + eval { $y++ }; + } + print $warn ? "not ok 229\n" : "ok 229\n"; +} + # Last test is: -sub last {228} +sub last {229} |