This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fix segfault on overloaded arithmetic assignment
[perl5.git] / t / lib / overload_nomethod.t
1 use warnings;
2 use strict;
3 use Test::Simple tests => 3;
4
5 package Foo;
6 use overload
7   nomethod => sub { die "unimplemented\n" };
8 sub new { bless {}, shift };
9
10 package main;
11
12 my $foo = Foo->new;
13
14 eval {my $val = $foo + 1};
15 ok( $@ =~ /unimplemented/ );
16
17 eval {$foo += 1};
18 ok( $@ =~ /unimplemented/ );
19
20 eval {my $val = 0; $val += $foo};
21 ok( $@ =~ /unimplemented/ );
22