1  util.c AOK
2
3     Illegal octal digit ignored
4	my $a = oct "029" ;
5
6     Illegal hex digit ignored
7	my $a = hex "0xv9" ;
8
9     Illegal binary digit ignored
10      my $a = oct "0b9" ;
11
12     Integer overflow in binary number
13	my $a =  oct "0b111111111111111111111111111111111111111111" ;
14     Binary number > 0b11111111111111111111111111111111 non-portable
15   	$a =  oct "0b111111111111111111111111111111111" ;
16     Integer overflow in octal number
17	my $a =  oct "077777777777777777777777777777" ;
18     Octal number > 037777777777 non-portable
19   	$a =  oct "0047777777777" ;
20     Integer overflow in hexadecimal number
21	my $a =  hex "0xffffffffffffffffffff" ;
22     Hexadecimal number > 0xffffffff non-portable
23   	$a =  hex "0x1ffffffff" ;
24
25__END__
26# util.c
27use warnings 'digit' ;
28my $a = oct "029" ;
29no warnings 'digit' ;
30$a = oct "029" ;
31EXPECT
32Illegal octal digit '9' ignored at - line 3.
33########
34# util.c
35use warnings 'digit' ;
36my $a =  hex "0xv9" ;
37no warnings 'digit' ;
38$a =  hex "0xv9" ;
39EXPECT
40Illegal hexadecimal digit 'v' ignored at - line 3.
41########
42# util.c
43use warnings 'digit' ;
44my $a =  oct "0b9" ;
45no warnings 'digit' ;
46$a =  oct "0b9" ;
47EXPECT
48Illegal binary digit '9' ignored at - line 3.
49########
50# util.c
51use warnings 'overflow' ;
52my $a =  oct "0b11111111111111111111111111111111111111111111111111111111111111111";
53no warnings 'overflow' ;
54$a =  oct "0b11111111111111111111111111111111111111111111111111111111111111111";
55EXPECT
56Integer overflow in binary number at - line 3.
57########
58# util.c
59use warnings 'overflow' ;
60my $a =  hex "0xffffffffffffffffffff" ;
61no warnings 'overflow' ;
62$a =  hex "0xffffffffffffffffffff" ;
63EXPECT
64Integer overflow in hexadecimal number at - line 3.
65########
66# util.c
67use warnings 'overflow' ;
68my $a =  oct "077777777777777777777777777777" ;
69no warnings 'overflow' ;
70$a =  oct "077777777777777777777777777777" ;
71EXPECT
72Integer overflow in octal number at - line 3.
73########
74# util.c
75use warnings 'portable' ;
76my $a =  oct "0b011111111111111111111111111111110" ;
77   $a =  oct "0b011111111111111111111111111111111" ;
78   $a =  oct "0b111111111111111111111111111111111" ;
79no warnings 'portable' ;
80   $a =  oct "0b011111111111111111111111111111110" ;
81   $a =  oct "0b011111111111111111111111111111111" ;
82   $a =  oct "0b111111111111111111111111111111111" ;
83EXPECT
84Binary number > 0b11111111111111111111111111111111 non-portable at - line 5.
85########
86# util.c
87use warnings 'portable' ;
88my $a =  hex "0x0fffffffe" ;
89   $a =  hex "0x0ffffffff" ;
90   $a =  hex "0x1ffffffff" ;
91no warnings 'portable' ;
92   $a =  hex "0x0fffffffe" ;
93   $a =  hex "0x0ffffffff" ;
94   $a =  hex "0x1ffffffff" ;
95EXPECT
96Hexadecimal number > 0xffffffff non-portable at - line 5.
97########
98# util.c
99use warnings 'portable' ;
100my $a =  oct "0037777777776" ;
101   $a =  oct "0037777777777" ;
102   $a =  oct "0047777777777" ;
103no warnings 'portable' ;
104   $a =  oct "0037777777776" ;
105   $a =  oct "0037777777777" ;
106   $a =  oct "0047777777777" ;
107EXPECT
108Octal number > 037777777777 non-portable at - line 5.
109########
110# util.c
111# NAME 132683: Use of uninitialized value" in warn() with constant folding and overloaded numbers
112use strict;
113use warnings;
114
115package Foo;
116
117use overload log => sub {
118    warn "here\n";                  # Use of uninitialized value in warn
119    CORE::log($_[0]->{value});
120};
121
122sub import {
123    overload::constant
124        integer => sub { __PACKAGE__->new($_[0]) };
125}
126
127sub new {
128    my ($class, $value) = @_;
129    bless {value => $value}, $class;
130}
131
132package main;
133
134BEGIN { Foo->import }
135my $x = log(2);
136EXPECT
137here
138