xref: /onnv-gate/usr/src/cmd/perl/5.8.4/distrib/t/lib/warnings/pp (revision 0:68f95e015346)
1*0Sstevel@tonic-gate  pp.c	TODO
2*0Sstevel@tonic-gate
3*0Sstevel@tonic-gate  substr outside of string
4*0Sstevel@tonic-gate    $a = "ab" ; $b = substr($a, 4,5) ;
5*0Sstevel@tonic-gate
6*0Sstevel@tonic-gate  Attempt to use reference as lvalue in substr
7*0Sstevel@tonic-gate    $a = "ab" ; $b = \$a ;  substr($b, 1,1) = $b
8*0Sstevel@tonic-gate
9*0Sstevel@tonic-gate  Use of uninitialized value in ref-to-glob cast	[pp_rv2gv()]
10*0Sstevel@tonic-gate	*b = *{ undef()}
11*0Sstevel@tonic-gate
12*0Sstevel@tonic-gate  Use of uninitialized value in scalar dereference	[pp_rv2sv()]
13*0Sstevel@tonic-gate	my $a = undef ; my $b = $$a
14*0Sstevel@tonic-gate
15*0Sstevel@tonic-gate  Odd number of elements in hash list
16*0Sstevel@tonic-gate	my $a = { 1,2,3 } ;
17*0Sstevel@tonic-gate
18*0Sstevel@tonic-gate  Explicit blessing to '' (assuming package main)
19*0Sstevel@tonic-gate	bless \[], "";
20*0Sstevel@tonic-gate
21*0Sstevel@tonic-gate  Constant subroutine %s undefined
22*0Sstevel@tonic-gate	sub foo () { 1 }; undef &foo;
23*0Sstevel@tonic-gate
24*0Sstevel@tonic-gate  Constant subroutine (anonymous) undefined
25*0Sstevel@tonic-gate	$foo = sub () { 3 }; undef &$foo;
26*0Sstevel@tonic-gate
27*0Sstevel@tonic-gate__END__
28*0Sstevel@tonic-gate# pp.c
29*0Sstevel@tonic-gateuse warnings 'substr' ;
30*0Sstevel@tonic-gate$a = "ab" ;
31*0Sstevel@tonic-gate$b = substr($a, 4,5) ;
32*0Sstevel@tonic-gateno warnings 'substr' ;
33*0Sstevel@tonic-gate$a = "ab" ;
34*0Sstevel@tonic-gate$b = substr($a, 4,5)  ;
35*0Sstevel@tonic-gateEXPECT
36*0Sstevel@tonic-gatesubstr outside of string at - line 4.
37*0Sstevel@tonic-gate########
38*0Sstevel@tonic-gate# pp.c
39*0Sstevel@tonic-gateuse warnings 'substr' ;
40*0Sstevel@tonic-gate$a = "ab" ;
41*0Sstevel@tonic-gate$b = \$a ;
42*0Sstevel@tonic-gatesubstr($b, 1,1) = "ab" ;
43*0Sstevel@tonic-gateno warnings 'substr' ;
44*0Sstevel@tonic-gatesubstr($b, 1,1) = "ab" ;
45*0Sstevel@tonic-gateEXPECT
46*0Sstevel@tonic-gateAttempt to use reference as lvalue in substr at - line 5.
47*0Sstevel@tonic-gate########
48*0Sstevel@tonic-gate# pp.c
49*0Sstevel@tonic-gateuse warnings 'uninitialized' ;
50*0Sstevel@tonic-gate*x = *{ undef() };
51*0Sstevel@tonic-gateno warnings 'uninitialized' ;
52*0Sstevel@tonic-gate*y = *{ undef() };
53*0Sstevel@tonic-gateEXPECT
54*0Sstevel@tonic-gateUse of uninitialized value in ref-to-glob cast at - line 3.
55*0Sstevel@tonic-gate########
56*0Sstevel@tonic-gate# pp.c
57*0Sstevel@tonic-gateuse warnings 'uninitialized';
58*0Sstevel@tonic-gate$x = undef; $y = $$x;
59*0Sstevel@tonic-gateno warnings 'uninitialized' ;
60*0Sstevel@tonic-gate$u = undef; $v = $$u;
61*0Sstevel@tonic-gateEXPECT
62*0Sstevel@tonic-gateUse of uninitialized value in scalar dereference at - line 3.
63*0Sstevel@tonic-gate########
64*0Sstevel@tonic-gate# pp.c
65*0Sstevel@tonic-gateuse warnings 'misc' ;
66*0Sstevel@tonic-gatemy $a = { 1,2,3};
67*0Sstevel@tonic-gateno warnings 'misc' ;
68*0Sstevel@tonic-gatemy $b = { 1,2,3};
69*0Sstevel@tonic-gateEXPECT
70*0Sstevel@tonic-gateOdd number of elements in anonymous hash at - line 3.
71*0Sstevel@tonic-gate########
72*0Sstevel@tonic-gate# pp.c
73*0Sstevel@tonic-gateuse warnings 'misc' ;
74*0Sstevel@tonic-gatebless \[], "" ;
75*0Sstevel@tonic-gateno warnings 'misc' ;
76*0Sstevel@tonic-gatebless \[], "" ;
77*0Sstevel@tonic-gateEXPECT
78*0Sstevel@tonic-gateExplicit blessing to '' (assuming package main) at - line 3.
79*0Sstevel@tonic-gate########
80*0Sstevel@tonic-gate# pp.c
81*0Sstevel@tonic-gateuse warnings 'misc';
82*0Sstevel@tonic-gatesub foo () { 1 }
83*0Sstevel@tonic-gateundef &foo;
84*0Sstevel@tonic-gateno warnings 'misc';
85*0Sstevel@tonic-gatesub bar () { 2 }
86*0Sstevel@tonic-gateundef &bar;
87*0Sstevel@tonic-gateEXPECT
88*0Sstevel@tonic-gateConstant subroutine foo undefined at - line 4.
89*0Sstevel@tonic-gate########
90*0Sstevel@tonic-gate# pp.c
91*0Sstevel@tonic-gateuse warnings 'misc';
92*0Sstevel@tonic-gate$foo = sub () { 3 };
93*0Sstevel@tonic-gateundef &$foo;
94*0Sstevel@tonic-gateno warnings 'misc';
95*0Sstevel@tonic-gate$bar = sub () { 4 };
96*0Sstevel@tonic-gateundef &$bar;
97*0Sstevel@tonic-gateEXPECT
98*0Sstevel@tonic-gateConstant subroutine (anonymous) undefined at - line 4.
99*0Sstevel@tonic-gate########
100*0Sstevel@tonic-gate# pp.c
101*0Sstevel@tonic-gateuse utf8 ;
102*0Sstevel@tonic-gate$_ = "\x80  \xff" ;
103*0Sstevel@tonic-gatereverse ;
104*0Sstevel@tonic-gateEXPECT
105