windows fixes for virtualizing child std{in,out,err} handles,
[p5sagit/p5-mst-13.2.git] / t / pragma / warn / pp
CommitLineData
599cee73 1 pp.c TODO
2
3 substr outside of string
4 $a = "ab" ; $a = 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 uninitialized in pp_rv2gv()
10 my *b = *{ undef()}
11
12 uninitialized in 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 Invalid type in unpack: '%c
19 my $A = pack ("A,A", 1,2) ;
20 my @A = unpack ("A,A", "22") ;
21
22 Attempt to pack pointer to temporary value
23 pack("p", "abc") ;
24
25 Explicit blessing to '' (assuming package main)
26 bless \[], "";
27
0453d815 28 Constant subroutine %s undefined <<<TODO
29 Constant subroutine (anonymous) undefined <<<TODO
30
31 Mandatory Warnings
32 ------------------
7e2040f0 33 Malformed UTF-8 character (not tested: difficult to produce with
34 perl now)
599cee73 35
36__END__
37# pp.c
4438c4b7 38use warnings 'substr' ;
599cee73 39$a = "ab" ;
0453d815 40$a = substr($a, 4,5);
4438c4b7 41no warnings 'substr' ;
0453d815 42$a = "ab" ;
43$a = substr($a, 4,5);
599cee73 44EXPECT
45substr outside of string at - line 4.
46########
47# pp.c
4438c4b7 48use warnings 'substr' ;
599cee73 49$a = "ab" ;
50$b = \$a ;
51substr($b, 1,1) = "ab" ;
4438c4b7 52no warnings 'substr' ;
0453d815 53substr($b, 1,1) = "ab" ;
599cee73 54EXPECT
55Attempt to use reference as lvalue in substr at - line 5.
56########
57# pp.c
4438c4b7 58use warnings 'uninitialized' ;
599cee73 59# TODO
60EXPECT
61
62########
63# pp.c
4438c4b7 64use warnings 'unsafe' ;
599cee73 65my $a = { 1,2,3};
4438c4b7 66no warnings 'unsafe' ;
0453d815 67my $b = { 1,2,3};
599cee73 68EXPECT
69Odd number of elements in hash assignment at - line 3.
70########
71# pp.c
4438c4b7 72use warnings 'unsafe' ;
599cee73 73my @a = unpack ("A,A", "22") ;
74my $a = pack ("A,A", 1,2) ;
4438c4b7 75no warnings 'unsafe' ;
0453d815 76my @b = unpack ("A,A", "22") ;
77my $b = pack ("A,A", 1,2) ;
599cee73 78EXPECT
79Invalid type in unpack: ',' at - line 3.
80Invalid type in pack: ',' at - line 4.
81########
82# pp.c
4438c4b7 83use warnings 'uninitialized' ;
599cee73 84my $a = undef ;
0453d815 85my $b = $$a;
4438c4b7 86no warnings 'uninitialized' ;
0453d815 87my $c = $$a;
599cee73 88EXPECT
b89fed5f 89Use of uninitialized value in scalar dereference at - line 4.
599cee73 90########
91# pp.c
4438c4b7 92use warnings 'unsafe' ;
599cee73 93sub foo { my $a = "a"; return $a . $a++ . $a++ }
94my $a = pack("p", &foo) ;
4438c4b7 95no warnings 'unsafe' ;
0453d815 96my $b = pack("p", &foo) ;
599cee73 97EXPECT
98Attempt to pack pointer to temporary value at - line 4.
99########
100# pp.c
4438c4b7 101use warnings 'unsafe' ;
599cee73 102bless \[], "" ;
4438c4b7 103no warnings 'unsafe' ;
0453d815 104bless \[], "" ;
599cee73 105EXPECT
106Explicit blessing to '' (assuming package main) at - line 3.
0453d815 107########
108# pp.c
109use utf8 ;
110$_ = "\x80 \xff" ;
111reverse ;
112EXPECT
0453d815 113########
114# pp.c
59af8754 115BEGIN {
116 if (ord("\t") == 5) {
117 print "SKIPPED\n# Character codes differ on ebcdic machines.";
118 exit 0;
119 }
120}
4438c4b7 121use warnings 'utf8' ;
0453d815 122use utf8 ;
123$_ = "\x80 \xff" ;
124reverse ;
4438c4b7 125no warnings 'utf8' ;
0453d815 126$_ = "\x80 \xff" ;
127reverse ;
128EXPECT
dc26be07 129\x80 will produce malformed UTF-8 character; use \x{80} for that at - line 10.
130\xff will produce malformed UTF-8 character; use \x{ff} for that at - line 10.