diff options
author | Rick Delaney <rick@consumercontact.com> | 2008-06-14 04:51:01 -0700 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2008-06-15 15:20:41 +0000 |
commit | 49c95d583ee26e3f8629868ab6da323b7c424640 (patch) | |
tree | 86172b333c6e0880f5a4252bc2f84c971849d5a1 /lib/overload.t | |
parent | cd1a9f552fc30b37bf1b6c770f1367c112fd1b1d (diff) | |
download | perl-49c95d583ee26e3f8629868ab6da323b7c424640.tar.gz |
[perl #55786] [PATCH blead] Re: Overload Segfaulting
From: Rick Delaney (via RT) <perlbug-followup@perl.org>
Message-ID: <rt-3.6.HEAD-22068-1213469460-652.55786-75-0@perl.org>
p4raw-id: //depot/perl@34055
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 44ead7ef60..7c2476cc8c 100644 --- a/lib/overload.t +++ b/lib/overload.t @@ -47,7 +47,7 @@ sub numify { 0 + "${$_[0]}" } # Not needed, additional overhead package main; $| = 1; -use Test::More tests => 556; +use Test::More tests => 558; $a = new Oscalar "087"; @@ -1427,4 +1427,20 @@ foreach my $op (qw(<=> == != < <= > >=)) { is($aref**1, $num_val, 'exponentiation of ref'); } +{ + package CopyConstructorFallback; + use overload + '++' => sub { "$_[0]"; $_[0] }, + fallback => 1; + sub new { bless {} => shift } + + package main; + + my $o = CopyConstructorFallback->new; + my $x = $o++; # would segfault + my $y = ++$o; + is($x, $o, "copy constructor falls back to assignment (postinc)"); + is($y, $o, "copy constructor falls back to assignment (preinc)"); +} + # EOF |