Commit | Line | Data |
599cee73 |
1 | pp.c TODO |
2 | |
3 | substr outside of string |
e476b1b5 |
4 | $a = "ab" ; $b = substr($a, 4,5) ; |
599cee73 |
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 |
38 | use warnings 'substr' ; |
599cee73 |
39 | $a = "ab" ; |
e476b1b5 |
40 | $b = substr($a, 4,5) ; |
4438c4b7 |
41 | no warnings 'substr' ; |
0453d815 |
42 | $a = "ab" ; |
e476b1b5 |
43 | $b = substr($a, 4,5) ; |
599cee73 |
44 | EXPECT |
45 | substr outside of string at - line 4. |
46 | ######## |
47 | # pp.c |
4438c4b7 |
48 | use warnings 'substr' ; |
599cee73 |
49 | $a = "ab" ; |
50 | $b = \$a ; |
51 | substr($b, 1,1) = "ab" ; |
4438c4b7 |
52 | no warnings 'substr' ; |
0453d815 |
53 | substr($b, 1,1) = "ab" ; |
599cee73 |
54 | EXPECT |
55 | Attempt to use reference as lvalue in substr at - line 5. |
56 | ######## |
57 | # pp.c |
4438c4b7 |
58 | use warnings 'uninitialized' ; |
599cee73 |
59 | # TODO |
60 | EXPECT |
61 | |
62 | ######## |
63 | # pp.c |
e476b1b5 |
64 | use warnings 'misc' ; |
599cee73 |
65 | my $a = { 1,2,3}; |
e476b1b5 |
66 | no warnings 'misc' ; |
0453d815 |
67 | my $b = { 1,2,3}; |
599cee73 |
68 | EXPECT |
69 | Odd number of elements in hash assignment at - line 3. |
70 | ######## |
71 | # pp.c |
e476b1b5 |
72 | use warnings 'pack' ; |
73 | use warnings 'unpack' ; |
599cee73 |
74 | my @a = unpack ("A,A", "22") ; |
75 | my $a = pack ("A,A", 1,2) ; |
e476b1b5 |
76 | no warnings 'pack' ; |
77 | no warnings 'unpack' ; |
0453d815 |
78 | my @b = unpack ("A,A", "22") ; |
79 | my $b = pack ("A,A", 1,2) ; |
599cee73 |
80 | EXPECT |
e476b1b5 |
81 | Invalid type in unpack: ',' at - line 4. |
82 | Invalid type in pack: ',' at - line 5. |
599cee73 |
83 | ######## |
84 | # pp.c |
4438c4b7 |
85 | use warnings 'uninitialized' ; |
599cee73 |
86 | my $a = undef ; |
0453d815 |
87 | my $b = $$a; |
4438c4b7 |
88 | no warnings 'uninitialized' ; |
0453d815 |
89 | my $c = $$a; |
599cee73 |
90 | EXPECT |
b89fed5f |
91 | Use of uninitialized value in scalar dereference at - line 4. |
599cee73 |
92 | ######## |
93 | # pp.c |
e476b1b5 |
94 | use warnings 'pack' ; |
599cee73 |
95 | sub foo { my $a = "a"; return $a . $a++ . $a++ } |
96 | my $a = pack("p", &foo) ; |
e476b1b5 |
97 | no warnings 'pack' ; |
0453d815 |
98 | my $b = pack("p", &foo) ; |
599cee73 |
99 | EXPECT |
100 | Attempt to pack pointer to temporary value at - line 4. |
101 | ######## |
102 | # pp.c |
e476b1b5 |
103 | use warnings 'misc' ; |
599cee73 |
104 | bless \[], "" ; |
e476b1b5 |
105 | no warnings 'misc' ; |
0453d815 |
106 | bless \[], "" ; |
599cee73 |
107 | EXPECT |
108 | Explicit blessing to '' (assuming package main) at - line 3. |
0453d815 |
109 | ######## |
110 | # pp.c |
111 | use utf8 ; |
112 | $_ = "\x80 \xff" ; |
113 | reverse ; |
114 | EXPECT |
0453d815 |
115 | ######## |
116 | # pp.c |
59af8754 |
117 | BEGIN { |
118 | if (ord("\t") == 5) { |
119 | print "SKIPPED\n# Character codes differ on ebcdic machines."; |
120 | exit 0; |
121 | } |
122 | } |
4438c4b7 |
123 | use warnings 'utf8' ; |
0453d815 |
124 | use utf8 ; |
125 | $_ = "\x80 \xff" ; |
126 | reverse ; |
4438c4b7 |
127 | no warnings 'utf8' ; |
0453d815 |
128 | $_ = "\x80 \xff" ; |
129 | reverse ; |
130 | EXPECT |
dc26be07 |
131 | \x80 will produce malformed UTF-8 character; use \x{80} for that at - line 10. |
132 | \xff will produce malformed UTF-8 character; use \x{ff} for that at - line 10. |