1  pp.c	TODO
2
3  substr outside of string
4    $a = "ab" ; $b = substr($a, 4,5) ;
5
6  Attempt to use reference as lvalue in substr 
7    $a = "ab" ; $b = \$a ;  substr($b, 1,1) = $b
8
9  Use of uninitialized value in scalar dereference	[pp_rv2sv()]
10	my $a = undef ; my $b = $$a
11
12  Odd number of elements in hash list
13	my $a = { 1,2,3 } ;
14
15  Explicit blessing to '' (assuming package main)
16	bless \[], "";
17
18  Constant subroutine %s undefined
19	sub foo () { 1 }; undef &foo;
20
21  Constant subroutine (anonymous) undefined
22	$foo = sub () { 3 }; undef &$foo;
23
24  Invalid negative number (%s) in chr
25
26__END__
27# pp.c
28use warnings 'substr' ;
29$a = "ab" ; 
30$b = substr($a, 4,5) ;
31no warnings 'substr' ;
32$a = "ab" ; 
33$b = substr($a, 4,5)  ;
34EXPECT
35substr outside of string at - line 4.
36########
37# pp.c
38use warnings 'substr' ;
39$a = "ab" ; 
40$b = \$a ;  
41substr($b, 1,1) = "ab" ;
42$b = \$a;
43substr($b, 1,1) = "\x{100}" ;
44no warnings 'substr' ;
45$b = \$a;
46substr($b, 1,1) = "ab" ;
47$b = \$a;
48substr($b, 1,1) = "\x{100}" ;
49EXPECT
50Attempt to use reference as lvalue in substr at - line 5.
51Attempt to use reference as lvalue in substr at - line 7.
52########
53# pp.c
54use warnings 'misc' ;
55@a = qw( a b c );
56splice(@a, 4, 0, 'e') ;
57@a = qw( a b c );
58splice(@a, 4, 1) ;
59@a = qw( a b c );
60splice(@a, 4) ;
61no warnings 'misc' ;
62@a = qw( a b c );
63splice(@a, 4, 0, 'e') ;
64@a = qw( a b c );
65splice(@a, 4, 1) ;
66@a = qw( a b c );
67splice(@a, 4) ;
68EXPECT
69splice() offset past end of array at - line 4.
70splice() offset past end of array at - line 6.
71########
72# pp.c
73use warnings 'uninitialized';
74$x = undef; $y = $$x;
75no warnings 'uninitialized' ;
76$u = undef; $v = $$u;
77EXPECT
78Use of uninitialized value $x in scalar dereference at - line 3.
79########
80# pp.c
81use warnings 'misc' ;
82my $a = { 1,2,3};
83no warnings 'misc' ;
84my $b = { 1,2,3};
85EXPECT
86Odd number of elements in anonymous hash at - line 3.
87########
88# pp.c
89use warnings 'misc' ;
90bless \[], "" ;
91no warnings 'misc' ;
92bless \[], "" ;
93EXPECT
94Explicit blessing to '' (assuming package main) at - line 3.
95########
96# pp.c
97use warnings 'misc';
98sub foo () { 1 }
99undef &foo;
100no warnings 'misc';
101sub bar () { 2 }
102undef &bar;
103EXPECT
104Constant subroutine foo undefined at - line 4.
105########
106# pp.c
107use utf8;
108use open qw( :utf8 :std );
109use warnings 'misc';
110sub ������ () { 1 }
111undef &������;
112no warnings 'misc';
113sub �� () { 2 }
114undef &��;
115EXPECT
116Constant subroutine ������ undefined at - line 6.
117########
118# pp.c
119use warnings 'misc';
120$foo = sub () { 3 };
121undef &$foo;
122no warnings 'misc';
123$bar = sub () { 4 };
124undef &$bar;
125EXPECT
126Constant subroutine (anonymous) undefined at - line 4.
127########
128# pp.c
129use utf8 ;
130$_ = "\x80  \xff" ;
131reverse ;
132EXPECT
133########
134# NAME chr -1
135use warnings 'utf8';
136my $chr = chr(-1);
137EXPECT
138Invalid negative number (-1) in chr at - line 2.
139