source: trunk/essentials/dev-lang/perl/t/lib/warnings/pp

Last change on this file was 3181, checked in by bird, 19 years ago

perl 5.8.8

File size: 2.1 KB
Line 
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 ref-to-glob cast [pp_rv2gv()]
10 *b = *{ undef()}
11
12 Use of uninitialized value in scalar dereference [pp_rv2sv()]
13 my $a = undef ; my $b = $$a
14
15 Odd number of elements in hash list
16 my $a = { 1,2,3 } ;
17
18 Explicit blessing to '' (assuming package main)
19 bless \[], "";
20
21 Constant subroutine %s undefined
22 sub foo () { 1 }; undef &foo;
23
24 Constant subroutine (anonymous) undefined
25 $foo = sub () { 3 }; undef &$foo;
26
27__END__
28# pp.c
29use warnings 'substr' ;
30$a = "ab" ;
31$b = substr($a, 4,5) ;
32no warnings 'substr' ;
33$a = "ab" ;
34$b = substr($a, 4,5) ;
35EXPECT
36substr outside of string at - line 4.
37########
38# pp.c
39use warnings 'substr' ;
40$a = "ab" ;
41$b = \$a ;
42substr($b, 1,1) = "ab" ;
43no warnings 'substr' ;
44substr($b, 1,1) = "ab" ;
45EXPECT
46Attempt to use reference as lvalue in substr at - line 5.
47########
48# pp.c
49use warnings 'uninitialized' ;
50*x = *{ undef() };
51no warnings 'uninitialized' ;
52*y = *{ undef() };
53EXPECT
54Use of uninitialized value in ref-to-glob cast at - line 3.
55########
56# pp.c
57use warnings 'uninitialized';
58$x = undef; $y = $$x;
59no warnings 'uninitialized' ;
60$u = undef; $v = $$u;
61EXPECT
62Use of uninitialized value in scalar dereference at - line 3.
63########
64# pp.c
65use warnings 'misc' ;
66my $a = { 1,2,3};
67no warnings 'misc' ;
68my $b = { 1,2,3};
69EXPECT
70Odd number of elements in anonymous hash at - line 3.
71########
72# pp.c
73use warnings 'misc' ;
74bless \[], "" ;
75no warnings 'misc' ;
76bless \[], "" ;
77EXPECT
78Explicit blessing to '' (assuming package main) at - line 3.
79########
80# pp.c
81use warnings 'misc';
82sub foo () { 1 }
83undef &foo;
84no warnings 'misc';
85sub bar () { 2 }
86undef &bar;
87EXPECT
88Constant subroutine foo undefined at - line 4.
89########
90# pp.c
91use warnings 'misc';
92$foo = sub () { 3 };
93undef &$foo;
94no warnings 'misc';
95$bar = sub () { 4 };
96undef &$bar;
97EXPECT
98Constant subroutine (anonymous) undefined at - line 4.
99########
100# pp.c
101use utf8 ;
102$_ = "\x80 \xff" ;
103reverse ;
104EXPECT
Note: See TracBrowser for help on using the repository browser.