This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
regcomp.c: Change \t to a - in debug dumping ranges
[perl5.git] / t / lib / warnings / op
1   op.c          AOK
2
3      Found = in conditional, should be ==
4         1 if $a = 1 ;
5
6      Useless use of time in void context
7      Useless use of a variable in void context
8      Useless use of a constant in void context
9         time ;
10         $a ;
11         "abc"
12
13      Useless use of sort in scalar context
14         my $x = sort (2,1,3);
15
16      Applying %s to %s will act on scalar(%s)
17         my $a ; my @a = () ; my %a = () ; my $b = \@a ; my $c = \%a ;
18         @a =~ /abc/ ;
19         @a =~ s/a/b/ ;
20         @a =~ tr/a/b/ ;
21         @$b =~ /abc/ ;
22         @$b =~ s/a/b/ ;
23         @$b =~ tr/a/b/ ;
24         %a =~ /abc/ ;
25         %a =~ s/a/b/ ;
26         %a =~ tr/a/b/ ;
27         %$c =~ /abc/ ;
28         %$c =~ s/a/b/ ;
29         %$c =~ tr/a/b/ ;
30
31
32      Parentheses missing around "my" list at -e line 1.
33        my $a, $b = (1,2);
34  
35      Parentheses missing around "local" list at -e line 1.
36        local $a, $b = (1,2);
37  
38      Bareword found in conditional at -e line 1.
39        use warnings 'bareword'; my $x = print(ABC || 1);
40  
41      Value of %s may be \"0\"; use \"defined\" 
42         $x = 1 if $x = <FH> ;
43         $x = 1 while $x = <FH> ;
44
45      Subroutine fred redefined at -e line 1.
46        sub fred{1;} sub fred{1;}
47  
48      Constant subroutine %s redefined 
49         sub fred() {1;} sub fred() {1;}
50  
51      Format FRED redefined at /tmp/x line 5.
52        format FRED =
53        .
54        format FRED =
55        .
56  
57      Array @%s missing the @ in argument %d of %s() 
58         push fred ;
59  
60      Hash %%%s missing the %% in argument %d of %s() 
61         keys joe ;
62  
63      Statement unlikely to be reached
64         (Maybe you meant system() when you said exec()?
65         exec "true" ; my $a
66
67      defined(@array) is deprecated
68         (Maybe you should just omit the defined()?)
69         my @a ; defined @a ;
70         defined (@a = (1,2,3)) ;
71
72      defined(%hash) is deprecated
73         (Maybe you should just omit the defined()?)
74         my %h ; defined %h ;
75
76      $[ used in comparison (did you mean $] ?)
77
78      length() used on @array (did you mean "scalar(@array)"?)
79      length() used on %hash (did you mean "scalar(keys %hash)"?)
80
81      /---/ should probably be written as "---"
82         join(/---/, @foo);
83
84     %s() called too early to check prototype            [Perl_peep]
85         fred() ; sub fred ($$) {}
86
87
88     Package '%s' not found (did you use the incorrect case?)
89
90     Use of /g modifier is meaningless in split
91
92     Possible precedence problem on bitwise %c operator  [Perl_ck_bitop]
93
94     Mandatory Warnings 
95     ------------------
96     Prototype mismatch:         [cv_ckproto]
97         sub fred() ;
98         sub fred($) {}
99
100     Runaway prototype           [newSUB]        TODO
101     oops: oopsAV                [oopsAV]        TODO
102     oops: oopsHV                [oopsHV]        TODO
103     
104 __END__
105 # op.c
106 use warnings 'syntax' ;
107 1 if $a = 1 ;
108 no warnings 'syntax' ;
109 1 if $a = 1 ;
110 EXPECT
111 Found = in conditional, should be == at - line 3.
112 ########
113 # op.c
114 use warnings 'syntax' ;
115 use constant foo => 1;
116 1 if $a = foo ;
117 no warnings 'syntax' ;
118 1 if $a = foo ;
119 EXPECT
120 ########
121 # op.c
122 my (@foo, %foo);
123 %main::foo->{"bar"};
124 %foo->{"bar"};
125 @main::foo->[23];
126 @foo->[23];
127 $main::foo = {}; %$main::foo->{"bar"};
128 $foo = {}; %$foo->{"bar"};
129 $main::foo = []; @$main::foo->[34];
130 $foo = []; @$foo->[34];
131 no warnings 'deprecated';
132 %main::foo->{"bar"};
133 %foo->{"bar"};
134 @main::foo->[23];
135 @foo->[23];
136 $main::foo = {}; %$main::foo->{"bar"};
137 $foo = {}; %$foo->{"bar"};
138 $main::foo = []; @$main::foo->[34];
139 $foo = []; @$foo->[34];
140 EXPECT
141 Using a hash as a reference is deprecated at - line 3.
142 Using a hash as a reference is deprecated at - line 4.
143 Using an array as a reference is deprecated at - line 5.
144 Using an array as a reference is deprecated at - line 6.
145 Using a hash as a reference is deprecated at - line 7.
146 Using a hash as a reference is deprecated at - line 8.
147 Using an array as a reference is deprecated at - line 9.
148 Using an array as a reference is deprecated at - line 10.
149 ########
150 # op.c
151 use warnings 'void' ; close STDIN ;
152 1 x 3 ;                 # OP_REPEAT
153                         # OP_GVSV
154 wantarray ;             # OP_WANTARRAY
155                         # OP_GV
156                         # OP_PADSV
157                         # OP_PADAV
158                         # OP_PADHV
159                         # OP_PADANY
160                         # OP_AV2ARYLEN
161 ref ;                   # OP_REF
162 \@a ;                   # OP_REFGEN
163 \$a ;                   # OP_SREFGEN
164 defined $a ;            # OP_DEFINED
165 hex $a ;                # OP_HEX
166 oct $a ;                # OP_OCT
167 length $a ;             # OP_LENGTH
168 substr $a,1 ;           # OP_SUBSTR
169 vec $a,1,2 ;            # OP_VEC
170 index $a,1,2 ;          # OP_INDEX
171 rindex $a,1,2 ;         # OP_RINDEX
172 sprintf $a ;            # OP_SPRINTF
173 $a[0] ;                 # OP_AELEM
174                         # OP_AELEMFAST
175 @a[0] ;                 # OP_ASLICE
176 #values %a ;            # OP_VALUES
177 #keys %a ;              # OP_KEYS
178 $a{0} ;                 # OP_HELEM
179 @a{0} ;                 # OP_HSLICE
180 unpack "a", "a" ;       # OP_UNPACK
181 pack $a,"" ;            # OP_PACK
182 join "" ;               # OP_JOIN
183 (@a)[0,1] ;             # OP_LSLICE
184                         # OP_ANONLIST
185                         # OP_ANONHASH
186 sort(1,2) ;             # OP_SORT
187 reverse(1,2) ;          # OP_REVERSE
188                         # OP_RANGE
189                         # OP_FLIP
190 (1 ..2) ;               # OP_FLOP
191 caller ;                # OP_CALLER
192 fileno STDIN ;          # OP_FILENO
193 eof STDIN ;             # OP_EOF
194 tell STDIN ;            # OP_TELL
195 readlink 1;             # OP_READLINK
196 time ;                  # OP_TIME
197 localtime ;             # OP_LOCALTIME
198 gmtime ;                # OP_GMTIME
199 eval { getgrnam 1 };    # OP_GGRNAM
200 eval { getgrgid 1 };    # OP_GGRGID
201 eval { getpwnam 1 };    # OP_GPWNAM
202 eval { getpwuid 1 };    # OP_GPWUID
203 prototype "foo";        # OP_PROTOTYPE
204 $a ~~ $b;               # OP_SMARTMATCH
205 $a <=> $b;              # OP_NCMP
206 use 5.015;
207 __SUB__                 # OP_RUNCV
208 EXPECT
209 Useless use of repeat (x) in void context at - line 3.
210 Useless use of wantarray in void context at - line 5.
211 Useless use of reference-type operator in void context at - line 12.
212 Useless use of reference constructor in void context at - line 13.
213 Useless use of single ref constructor in void context at - line 14.
214 Useless use of defined operator in void context at - line 15.
215 Useless use of hex in void context at - line 16.
216 Useless use of oct in void context at - line 17.
217 Useless use of length in void context at - line 18.
218 Useless use of substr in void context at - line 19.
219 Useless use of vec in void context at - line 20.
220 Useless use of index in void context at - line 21.
221 Useless use of rindex in void context at - line 22.
222 Useless use of sprintf in void context at - line 23.
223 Useless use of array element in void context at - line 24.
224 Useless use of array slice in void context at - line 26.
225 Useless use of hash element in void context at - line 29.
226 Useless use of hash slice in void context at - line 30.
227 Useless use of unpack in void context at - line 31.
228 Useless use of pack in void context at - line 32.
229 Useless use of join or string in void context at - line 33.
230 Useless use of list slice in void context at - line 34.
231 Useless use of sort in void context at - line 37.
232 Useless use of reverse in void context at - line 38.
233 Useless use of range (or flop) in void context at - line 41.
234 Useless use of caller in void context at - line 42.
235 Useless use of fileno in void context at - line 43.
236 Useless use of eof in void context at - line 44.
237 Useless use of tell in void context at - line 45.
238 Useless use of readlink in void context at - line 46.
239 Useless use of time in void context at - line 47.
240 Useless use of localtime in void context at - line 48.
241 Useless use of gmtime in void context at - line 49.
242 Useless use of getgrnam in void context at - line 50.
243 Useless use of getgrgid in void context at - line 51.
244 Useless use of getpwnam in void context at - line 52.
245 Useless use of getpwuid in void context at - line 53.
246 Useless use of subroutine prototype in void context at - line 54.
247 Useless use of smart match in void context at - line 55.
248 Useless use of numeric comparison (<=>) in void context at - line 56.
249 Useless use of __SUB__ in void context at - line 58.
250 ########
251 # op.c
252 use warnings 'void' ; close STDIN ;
253 my $x = sort (2,1,3);
254 no warnings 'void' ;
255 $x = sort (2,1,3);
256 EXPECT
257 Useless use of sort in scalar context at - line 3.
258 ########
259 # op.c
260 no warnings 'void' ; close STDIN ;
261 1 x 3 ;                 # OP_REPEAT
262                         # OP_GVSV
263 wantarray ;             # OP_WANTARRAY
264                         # OP_GV
265                         # OP_PADSV
266                         # OP_PADAV
267                         # OP_PADHV
268                         # OP_PADANY
269                         # OP_AV2ARYLEN
270 ref ;                   # OP_REF
271 \@a ;                   # OP_REFGEN
272 \$a ;                   # OP_SREFGEN
273 defined $a ;            # OP_DEFINED
274 hex $a ;                # OP_HEX
275 oct $a ;                # OP_OCT
276 length $a ;             # OP_LENGTH
277 substr $a,1 ;           # OP_SUBSTR
278 vec $a,1,2 ;            # OP_VEC
279 index $a,1,2 ;          # OP_INDEX
280 rindex $a,1,2 ;         # OP_RINDEX
281 sprintf $a ;            # OP_SPRINTF
282 $a[0] ;                 # OP_AELEM
283                         # OP_AELEMFAST
284 @a[0] ;                 # OP_ASLICE
285 #values %a ;            # OP_VALUES
286 #keys %a ;              # OP_KEYS
287 $a{0} ;                 # OP_HELEM
288 @a{0} ;                 # OP_HSLICE
289 unpack "a", "a" ;       # OP_UNPACK
290 pack $a,"" ;            # OP_PACK
291 join "" ;               # OP_JOIN
292 (@a)[0,1] ;             # OP_LSLICE
293                         # OP_ANONLIST
294                         # OP_ANONHASH
295 sort(1,2) ;             # OP_SORT
296 reverse(1,2) ;          # OP_REVERSE
297                         # OP_RANGE
298                         # OP_FLIP
299 (1 ..2) ;               # OP_FLOP
300 caller ;                # OP_CALLER
301 fileno STDIN ;          # OP_FILENO
302 eof STDIN ;             # OP_EOF
303 tell STDIN ;            # OP_TELL
304 readlink 1;             # OP_READLINK
305 time ;                  # OP_TIME
306 localtime ;             # OP_LOCALTIME
307 gmtime ;                # OP_GMTIME
308 eval { getgrnam 1 };    # OP_GGRNAM
309 eval { getgrgid 1 };    # OP_GGRGID
310 eval { getpwnam 1 };    # OP_GPWNAM
311 eval { getpwuid 1 };    # OP_GPWUID
312 prototype "foo";        # OP_PROTOTYPE
313 EXPECT
314 ########
315 # op.c
316 use warnings 'void' ;
317 for (@{[0]}) { "$_" }           # check warning isn't duplicated
318 no warnings 'void' ;
319 for (@{[0]}) { "$_" }           # check warning isn't duplicated
320 EXPECT
321 Useless use of string in void context at - line 3.
322 ########
323 # op.c
324 use warnings 'void' ;
325 use Config ;
326 BEGIN {
327     if ( ! $Config{d_telldir}) {
328         print <<EOM ;
329 SKIPPED
330 # telldir not present
331 EOM
332         exit 
333     }
334 }
335 telldir 1 ;             # OP_TELLDIR
336 no warnings 'void' ;
337 telldir 1 ;             # OP_TELLDIR
338 EXPECT
339 Useless use of telldir in void context at - line 13.
340 ########
341 # op.c
342 use warnings 'void' ;
343 use Config ;
344 BEGIN {
345     if ( ! $Config{d_getppid}) {
346         print <<EOM ;
347 SKIPPED
348 # getppid not present
349 EOM
350         exit 
351     }
352 }
353 getppid ;               # OP_GETPPID
354 no warnings 'void' ;
355 getppid ;               # OP_GETPPID
356 EXPECT
357 Useless use of getppid in void context at - line 13.
358 ########
359 # op.c
360 use warnings 'void' ;
361 use Config ;
362 BEGIN {
363     if ( ! $Config{d_getpgrp}) {
364         print <<EOM ;
365 SKIPPED
366 # getpgrp not present
367 EOM
368         exit 
369     }
370 }
371 getpgrp ;               # OP_GETPGRP
372 no warnings 'void' ;
373 getpgrp ;               # OP_GETPGRP
374 EXPECT
375 Useless use of getpgrp in void context at - line 13.
376 ########
377 # op.c
378 use warnings 'void' ;
379 use Config ;
380 BEGIN {
381     if ( ! $Config{d_times}) {
382         print <<EOM ;
383 SKIPPED
384 # times not present
385 EOM
386         exit 
387     }
388 }
389 times ;                 # OP_TMS
390 no warnings 'void' ;
391 times ;                 # OP_TMS
392 EXPECT
393 Useless use of times in void context at - line 13.
394 ########
395 # op.c
396 use warnings 'void' ;
397 use Config ;
398 BEGIN {
399     if ( ! $Config{d_getprior} or $^O eq 'os2') { # Locks before fixpak22
400         print <<EOM ;
401 SKIPPED
402 # getpriority not present
403 EOM
404         exit 
405     }
406 }
407 getpriority 1,2;        # OP_GETPRIORITY
408 no warnings 'void' ;
409 getpriority 1,2;        # OP_GETPRIORITY
410 EXPECT
411 Useless use of getpriority in void context at - line 13.
412 ########
413 # op.c
414 use warnings 'void' ;
415 use Config ;
416 BEGIN {
417     if ( ! $Config{d_getlogin}) {
418         print <<EOM ;
419 SKIPPED
420 # getlogin not present
421 EOM
422         exit 
423     }
424 }
425 getlogin ;                      # OP_GETLOGIN
426 no warnings 'void' ;
427 getlogin ;                      # OP_GETLOGIN
428 EXPECT
429 Useless use of getlogin in void context at - line 13.
430 ########
431 # op.c
432 use warnings 'void' ;
433 use Config ; BEGIN {
434 if ( ! $Config{d_socket}) {
435     print <<EOM ;
436 SKIPPED
437 # getsockname not present
438 # getpeername not present
439 # gethostbyname not present
440 # gethostbyaddr not present
441 # gethostent not present
442 # getnetbyname not present
443 # getnetbyaddr not present
444 # getnetent not present
445 # getprotobyname not present
446 # getprotobynumber not present
447 # getprotoent not present
448 # getservbyname not present
449 # getservbyport not present
450 # getservent not present
451 EOM
452     exit 
453 } }
454 getsockname STDIN ;     # OP_GETSOCKNAME
455 getpeername STDIN ;     # OP_GETPEERNAME
456 gethostbyname 1 ;       # OP_GHBYNAME
457 gethostbyaddr 1,2;      # OP_GHBYADDR
458 gethostent ;            # OP_GHOSTENT
459 getnetbyname 1 ;        # OP_GNBYNAME
460 getnetbyaddr 1,2 ;      # OP_GNBYADDR
461 getnetent ;             # OP_GNETENT
462 getprotobyname 1;       # OP_GPBYNAME
463 getprotobynumber 1;     # OP_GPBYNUMBER
464 getprotoent ;           # OP_GPROTOENT
465 getservbyname 1,2;      # OP_GSBYNAME
466 getservbyport 1,2;      # OP_GSBYPORT
467 getservent ;            # OP_GSERVENT
468
469 no warnings 'void' ;
470 getsockname STDIN ;     # OP_GETSOCKNAME
471 getpeername STDIN ;     # OP_GETPEERNAME
472 gethostbyname 1 ;       # OP_GHBYNAME
473 gethostbyaddr 1,2;      # OP_GHBYADDR
474 gethostent ;            # OP_GHOSTENT
475 getnetbyname 1 ;        # OP_GNBYNAME
476 getnetbyaddr 1,2 ;      # OP_GNBYADDR
477 getnetent ;             # OP_GNETENT
478 getprotobyname 1;       # OP_GPBYNAME
479 getprotobynumber 1;     # OP_GPBYNUMBER
480 getprotoent ;           # OP_GPROTOENT
481 getservbyname 1,2;      # OP_GSBYNAME
482 getservbyport 1,2;      # OP_GSBYPORT
483 getservent ;            # OP_GSERVENT
484 INIT {
485    # some functions may not be there, so we exit without running
486    exit;
487 }
488 EXPECT
489 Useless use of getsockname in void context at - line 24.
490 Useless use of getpeername in void context at - line 25.
491 Useless use of gethostbyname in void context at - line 26.
492 Useless use of gethostbyaddr in void context at - line 27.
493 Useless use of gethostent in void context at - line 28.
494 Useless use of getnetbyname in void context at - line 29.
495 Useless use of getnetbyaddr in void context at - line 30.
496 Useless use of getnetent in void context at - line 31.
497 Useless use of getprotobyname in void context at - line 32.
498 Useless use of getprotobynumber in void context at - line 33.
499 Useless use of getprotoent in void context at - line 34.
500 Useless use of getservbyname in void context at - line 35.
501 Useless use of getservbyport in void context at - line 36.
502 Useless use of getservent in void context at - line 37.
503 ########
504 # op.c
505 use warnings 'void' ;
506 *a ; # OP_RV2GV
507 $a ; # OP_RV2SV
508 @a ; # OP_RV2AV
509 %a ; # OP_RV2HV
510 no warnings 'void' ;
511 *a ; # OP_RV2GV
512 $a ; # OP_RV2SV
513 @a ; # OP_RV2AV
514 %a ; # OP_RV2HV
515 EXPECT
516 Useless use of a variable in void context at - line 3.
517 Useless use of a variable in void context at - line 4.
518 Useless use of a variable in void context at - line 5.
519 Useless use of a variable in void context at - line 6.
520 ########
521 # op.c
522 use warnings 'void' ;
523 "abc"; # OP_CONST
524 7 ; # OP_CONST
525 "x" . "y"; # optimized to OP_CONST
526 2 + 2; # optimized to OP_CONST
527 use constant U => undef;
528 U;
529 5 || print "bad\n";     # test OPpCONST_SHORTCIRCUIT
530 print "boo\n" if U;     # test OPpCONST_SHORTCIRCUIT
531 no warnings 'void' ;
532 "abc"; # OP_CONST
533 7 ; # OP_CONST
534 "x" . "y"; # optimized to OP_CONST
535 2 + 2; # optimized to OP_CONST
536 EXPECT
537 Useless use of a constant (abc) in void context at - line 3.
538 Useless use of a constant (7) in void context at - line 4.
539 Useless use of a constant (xy) in void context at - line 5.
540 Useless use of a constant (4) in void context at - line 6.
541 Useless use of a constant (undef) in void context at - line 8.
542 ########
543 # op.c
544 use utf8;
545 use open qw( :utf8 :std );
546 use warnings 'void' ;
547 "àḆc"; # OP_CONST
548 "Ẋ" . "ƴ"; # optimized to OP_CONST
549 FOO;     # Bareword optimized to OP_CONST
550 use constant ů => undef;
551 ů;
552 5 || print "bad\n";     # test OPpCONST_SHORTCIRCUIT
553 print "boo\n" if ů;    # test OPpCONST_SHORTCIRCUIT
554 no warnings 'void' ;
555 "àḆc"; # OP_CONST
556 "Ẋ" . "ƴ"; # optimized to OP_CONST
557 EXPECT
558 Useless use of a constant (àḆc) in void context at - line 5.
559 Useless use of a constant (Ẋƴ) in void context at - line 6.
560 Useless use of a constant (FOO) in void context at - line 7.
561 Useless use of a constant (undef) in void context at - line 9.
562 ########
563 # op.c
564 #
565 use warnings 'misc' ;
566 my $a ; my @a = () ; my %a = () ; my $b = \@a ; my $c = \%a ;my $d = 'test';
567 @a =~ /abc/ ;
568 @a2 =~ s/a/b/ ;
569 @a3 =~ tr/a/b/ ;
570 @$b =~ /abc/ ;
571 @$b =~ s/a/b/ ;
572 @$b =~ tr/a/b/ ;
573 %a =~ /abc/ ;
574 %a2 =~ s/a/b/ ;
575 %a3 =~ tr/a/b/ ;
576 %$c =~ /abc/ ;
577 %$c =~ s/a/b/ ;
578 %$c =~ tr/a/b/ ;
579 $d =~ tr/a/b/d ;
580 $d2 =~ tr/a/bc/;
581 {
582 no warnings 'misc' ;
583 my $a ; my @a = () ; my %a = () ; my $b = \@a ; my $c = \%a ; my $d = 'test';
584 @a =~ /abc/ ;
585 @a =~ s/a/b/ ;
586 @a =~ tr/a/b/ ;
587 @$b =~ /abc/ ;
588 @$b =~ s/a/b/ ;
589 @$b =~ tr/a/b/ ;
590 %a =~ /abc/ ;
591 %a =~ s/a/b/ ;
592 %a =~ tr/a/b/ ;
593 %$c =~ /abc/ ;
594 %$c =~ s/a/b/ ;
595 %$c =~ tr/a/b/ ;
596 $d =~ tr/a/b/d ;
597 $d =~ tr/a/bc/ ;
598 }
599 EXPECT
600 Applying pattern match (m//) to @a will act on scalar(@a) at - line 5.
601 Applying substitution (s///) to @a2 will act on scalar(@a2) at - line 6.
602 Applying transliteration (tr///) to @a3 will act on scalar(@a3) at - line 7.
603 Applying pattern match (m//) to @array will act on scalar(@array) at - line 8.
604 Applying substitution (s///) to @array will act on scalar(@array) at - line 9.
605 Applying transliteration (tr///) to @array will act on scalar(@array) at - line 10.
606 Applying pattern match (m//) to %a will act on scalar(%a) at - line 11.
607 Applying substitution (s///) to %a2 will act on scalar(%a2) at - line 12.
608 Applying transliteration (tr///) to %a3 will act on scalar(%a3) at - line 13.
609 Applying pattern match (m//) to %hash will act on scalar(%hash) at - line 14.
610 Applying substitution (s///) to %hash will act on scalar(%hash) at - line 15.
611 Applying transliteration (tr///) to %hash will act on scalar(%hash) at - line 16.
612 Useless use of /d modifier in transliteration operator at - line 17.
613 Replacement list is longer than search list at - line 18.
614 Can't modify array dereference in substitution (s///) at - line 6, near "s/a/b/ ;"
615 BEGIN not safe after errors--compilation aborted at - line 20.
616 ########
617 # op.c
618 use warnings 'parenthesis' ;
619 my $a, $b = (1,2);
620 my @foo,%bar,   $quux; # there's a TAB here
621 my $x, $y or print;
622 no warnings 'parenthesis' ;
623 my $c, $d = (1,2);
624 EXPECT
625 Parentheses missing around "my" list at - line 3.
626 Parentheses missing around "my" list at - line 4.
627 ########
628 # op.c
629 use warnings 'parenthesis' ;
630 our $a, $b = (1,2);
631 no warnings 'parenthesis' ;
632 our $c, $d = (1,2);
633 EXPECT
634 Parentheses missing around "our" list at - line 3.
635 ########
636 # op.c
637 use warnings 'parenthesis' ;
638 local $a, $b = (1,2);
639 local *f, *g;
640 no warnings 'parenthesis' ;
641 local $c, $d = (1,2);
642 EXPECT
643 Parentheses missing around "local" list at - line 3.
644 Parentheses missing around "local" list at - line 4.
645 ########
646 # op.c
647 use warnings 'bareword' ;
648 print (ABC || 1) ;
649 no warnings 'bareword' ;
650 print (ABC || 1) ;
651 EXPECT
652 Bareword found in conditional at - line 3.
653 ########
654 --FILE-- abc
655
656 --FILE--
657 # op.c
658 use warnings 'misc' ;
659 open FH, "<abc" ;
660 $x = 1 if $x = <FH> ;
661 no warnings 'misc' ;
662 $x = 1 if $x = <FH> ;
663 EXPECT
664 Value of <HANDLE> construct can be "0"; test with defined() at - line 4.
665 ########
666 # op.c
667 use warnings 'misc' ;
668 opendir FH, "." ;
669 $x = 1 if $x = readdir FH ;
670 no warnings 'misc' ;
671 $x = 1 if $x = readdir FH ;
672 closedir FH ;
673 EXPECT
674 Value of readdir() operator can be "0"; test with defined() at - line 4.
675 ########
676 # op.c
677 use warnings 'misc' ;
678 $x = 1 if $x = <*> ;
679 no warnings 'misc' ;
680 $x = 1 if $x = <*> ;
681 EXPECT
682 Value of glob construct can be "0"; test with defined() at - line 3.
683 ########
684 # op.c
685 use warnings 'misc' ;
686 %a = (1,2,3,4) ;
687 $x = 1 if $x = each %a ;
688 no warnings 'misc' ;
689 $x = 1 if $x = each %a ;
690 EXPECT
691 Value of each() operator can be "0"; test with defined() at - line 4.
692 ########
693 # op.c
694 use warnings 'misc' ;
695 $x = 1 while $x = <*> and 0 ;
696 no warnings 'misc' ;
697 $x = 1 while $x = <*> and 0 ;
698 EXPECT
699 Value of glob construct can be "0"; test with defined() at - line 3.
700 ########
701 # op.c
702 use warnings 'misc' ;
703 opendir FH, "." ;
704 $x = 1 while $x = readdir FH and 0 ;
705 no warnings 'misc' ;
706 $x = 1 while $x = readdir FH and 0 ;
707 closedir FH ;
708 EXPECT
709 Value of readdir() operator can be "0"; test with defined() at - line 4.
710 ########
711 # op.c
712 use warnings 'misc';
713 open FH, "<abc";
714 ($_ = <FH>) // ($_ = 1);
715 opendir DH, ".";
716 %a = (1,2,3,4) ;
717 EXPECT
718 ########
719 # op.c
720 use warnings 'redefine' ;
721 sub fred {}
722 sub fred {}
723 no warnings 'redefine' ;
724 sub fred {}
725 EXPECT
726 Subroutine fred redefined at - line 4.
727 ########
728 # op.c
729 use warnings 'redefine' ;
730 sub fred () { 1 }
731 sub fred () { 1 }
732 no warnings 'redefine' ;
733 sub fred () { 1 }
734 EXPECT
735 Constant subroutine fred redefined at - line 4.
736 ########
737 # op.c
738 sub fred () { 1 }
739 sub fred () { 2 }
740 EXPECT
741 Constant subroutine fred redefined at - line 3.
742 ########
743 # op.c
744 sub fred () { 1 }
745 *fred = sub () { 2 };
746 EXPECT
747 Constant subroutine main::fred redefined at - line 3.
748 ########
749 # op.c
750 no warnings 'redefine' ;
751 sub fred () { 1 }
752 sub fred () { 2 }
753 EXPECT
754 ########
755 # op.c
756 no warnings 'redefine' ;
757 sub fred () { 1 }
758 *fred = sub () { 2 };
759 EXPECT
760 ########
761 # op.c
762 use warnings 'redefine' ;
763 format FRED =
764 .
765 format FRED =
766 .
767 no warnings 'redefine' ;
768 format FRED =
769 .
770 EXPECT
771 Format FRED redefined at - line 5.
772 ########
773 # op.c
774 push FRED;
775 no warnings 'deprecated' ;
776 push FRED;
777 EXPECT
778 Array @FRED missing the @ in argument 1 of push() at - line 2.
779 ########
780 # op.c
781 @a = keys FRED ;
782 no warnings 'deprecated' ;
783 @a = keys FRED ;
784 EXPECT
785 Hash %FRED missing the % in argument 1 of keys() at - line 2.
786 ########
787 # op.c
788 use warnings 'syntax' ;
789 exec "$^X -e 1" ; 
790 my $a
791 EXPECT
792 Statement unlikely to be reached at - line 4.
793         (Maybe you meant system() when you said exec()?)
794 ########
795 # op.c, no warning if exec isn't a statement.
796 use warnings 'syntax' ;
797 $a || exec "$^X -e 1" ;
798 my $a
799 EXPECT
800 ########
801 # op.c
802 my @a; defined(@a);
803 EXPECT
804 defined(@array) is deprecated at - line 2.
805         (Maybe you should just omit the defined()?)
806 ########
807 # op.c
808 defined(@a = (1,2,3));
809 EXPECT
810 defined(@array) is deprecated at - line 2.
811         (Maybe you should just omit the defined()?)
812 ########
813 # op.c
814 my %h; defined(%h);
815 EXPECT
816 defined(%hash) is deprecated at - line 2.
817         (Maybe you should just omit the defined()?)
818 ########
819 # op.c
820 no warnings 'syntax' ;
821 exec "$^X -e 1" ; 
822 my $a
823 EXPECT
824
825 ########
826 # op.c
827 sub fred();
828 sub fred($) {}
829 EXPECT
830 Prototype mismatch: sub main::fred () vs ($) at - line 3.
831 ########
832 # op.c
833 use utf8;
834 use open qw( :utf8 :std );
835 sub frèd();
836 sub frèd($) {}
837 EXPECT
838 Prototype mismatch: sub main::frèd () vs ($) at - line 5.
839 ########
840 # op.c
841 use utf8;
842 use open qw( :utf8 :std );
843 use warnings;
844 eval "sub fòò (\$\0) {}";
845 EXPECT
846 Illegal character in prototype for main::fòò : $\x{0} at (eval 1) line 1.
847 ########
848 # op.c
849 use utf8;
850 use open qw( :utf8 :std );
851 use warnings;
852 eval "sub foo (\0) {}";
853 EXPECT
854 Illegal character in prototype for main::foo : \x{0} at (eval 1) line 1.
855 ########
856 # op.c
857 use utf8;
858 use open qw( :utf8 :std );
859 use warnings;
860 BEGIN { $::{"foo"} = "\$\0L\351on" }
861 BEGIN { eval "sub foo (\$\0L\x{c3}\x{a9}on) {}"; }
862 EXPECT
863 Illegal character in prototype for main::foo : $\x{0}L... at (eval 1) line 1.
864 ########
865 # op.c
866 use utf8;
867 use open qw( :utf8 :std );
868 use warnings;
869 BEGIN { eval "sub foo (\0) {}"; }
870 EXPECT
871 Illegal character in prototype for main::foo : \x{0} at (eval 1) line 1.
872 ########
873 # op.c
874 use utf8;
875 use open qw( :utf8 :std );
876 use warnings;
877 BEGIN { $::{"foo"} = "\x{30cb}" }
878 BEGIN { eval "sub foo {}"; }
879 EXPECT
880 Prototype mismatch: sub main::foo (ニ) vs none at (eval 1) line 1.
881 ########
882 # op.c
883 $^W = 0 ;
884 sub fred() ;
885 sub fred($) {}
886 {
887     no warnings 'prototype' ;
888     sub Fred() ;
889     sub Fred($) {}
890     use warnings 'prototype' ;
891     sub freD() ;
892     sub freD($) {}
893 }
894 sub FRED() ;
895 sub FRED($) {}
896 EXPECT
897 Prototype mismatch: sub main::fred () vs ($) at - line 4.
898 Prototype mismatch: sub main::freD () vs ($) at - line 11.
899 Prototype mismatch: sub main::FRED () vs ($) at - line 14.
900 ########
901 # op.c [Perl_ck_cmp]
902 use warnings 'syntax' ;
903 no warnings 'deprecated';
904 @a = $[ < 5;
905 @a = $[ > 5;
906 @a = $[ <= 5;
907 @a = $[ >= 5;
908 @a = 42 < $[;
909 @a = 42 > $[;
910 @a = 42 <= $[;
911 @a = 42 >= $[;
912 use integer;
913 @a = $[ < 5;
914 @a = $[ > 5;
915 @a = $[ <= 5;
916 @a = $[ >= 5;
917 @a = 42 < $[;
918 @a = 42 > $[;
919 @a = 42 <= $[;
920 @a = 42 >= $[;
921 no integer;
922 @a = $[ < $5;
923 @a = $[ > $5;
924 @a = $[ <= $5;
925 @a = $[ >= $5;
926 @a = $42 < $[;
927 @a = $42 > $[;
928 @a = $42 <= $[;
929 @a = $42 >= $[;
930 use integer;
931 @a = $[ < $5;
932 @a = $[ > $5;
933 @a = $[ <= $5;
934 @a = $[ >= $5;
935 @a = $42 < $[;
936 @a = $42 > $[;
937 @a = $42 <= $[;
938 @a = $42 >= $[;
939 EXPECT
940 $[ used in numeric lt (<) (did you mean $] ?) at - line 4.
941 $[ used in numeric gt (>) (did you mean $] ?) at - line 5.
942 $[ used in numeric le (<=) (did you mean $] ?) at - line 6.
943 $[ used in numeric ge (>=) (did you mean $] ?) at - line 7.
944 $[ used in numeric lt (<) (did you mean $] ?) at - line 8.
945 $[ used in numeric gt (>) (did you mean $] ?) at - line 9.
946 $[ used in numeric le (<=) (did you mean $] ?) at - line 10.
947 $[ used in numeric ge (>=) (did you mean $] ?) at - line 11.
948 $[ used in numeric lt (<) (did you mean $] ?) at - line 13.
949 $[ used in numeric gt (>) (did you mean $] ?) at - line 14.
950 $[ used in numeric le (<=) (did you mean $] ?) at - line 15.
951 $[ used in numeric ge (>=) (did you mean $] ?) at - line 16.
952 $[ used in numeric lt (<) (did you mean $] ?) at - line 17.
953 $[ used in numeric gt (>) (did you mean $] ?) at - line 18.
954 $[ used in numeric le (<=) (did you mean $] ?) at - line 19.
955 $[ used in numeric ge (>=) (did you mean $] ?) at - line 20.
956 ########
957 # op.c [Perl_ck_length]
958 use warnings 'syntax' ;
959 length(@a);
960 length(%b);
961 length(@$c);
962 length(%$d);
963 length($a);
964 length(my %h);
965 length(my @g);
966 EXPECT
967 length() used on @a (did you mean "scalar(@a)"?) at - line 3.
968 length() used on %b (did you mean "scalar(keys %b)"?) at - line 4.
969 length() used on @array (did you mean "scalar(@array)"?) at - line 5.
970 length() used on %hash (did you mean "scalar(keys %hash)"?) at - line 6.
971 length() used on %h (did you mean "scalar(keys %h)"?) at - line 8.
972 length() used on @g (did you mean "scalar(@g)"?) at - line 9.
973 ########
974 # op.c
975 use warnings 'syntax' ;
976 join /---/, 'x', 'y', 'z';
977 EXPECT
978 /---/ should probably be written as "---" at - line 3.
979 ########
980 # op.c [Perl_peep]
981 use warnings 'prototype' ;
982 fred() ; 
983 sub fred ($$) {}
984 no warnings 'prototype' ;
985 joe() ; 
986 sub joe ($$) {}
987 EXPECT
988 main::fred() called too early to check prototype at - line 3.
989 ########
990 # op.c [Perl_newATTRSUB]
991 --FILE-- abc.pm
992 use warnings 'void' ;
993 BEGIN { $| = 1; print "in begin\n"; }
994 CHECK { print "in check\n"; }
995 INIT { print "in init\n"; }
996 END { print "in end\n"; }
997 print "in mainline\n";
998 1;
999 --FILE--
1000 use abc;
1001 delete $INC{"abc.pm"};
1002 require abc;
1003 do "abc.pm";
1004 EXPECT
1005 in begin
1006 in mainline
1007 in check
1008 in init
1009 in begin
1010 Too late to run CHECK block at abc.pm line 3.
1011 Too late to run INIT block at abc.pm line 4.
1012 in mainline
1013 in begin
1014 Too late to run CHECK block at abc.pm line 3.
1015 Too late to run INIT block at abc.pm line 4.
1016 in mainline
1017 in end
1018 in end
1019 in end
1020 ########
1021 # op.c [Perl_newATTRSUB]
1022 --FILE-- abc.pm
1023 no warnings 'void' ;
1024 BEGIN { $| = 1; print "in begin\n"; }
1025 CHECK { print "in check\n"; }
1026 INIT { print "in init\n"; }
1027 END { print "in end\n"; }
1028 print "in mainline\n";
1029 1;
1030 --FILE--
1031 require abc;
1032 do "abc.pm";
1033 EXPECT
1034 in begin
1035 in mainline
1036 in begin
1037 in mainline
1038 in end
1039 in end
1040 ########
1041 # op.c
1042 my @x;
1043 use warnings 'syntax' ;
1044 push(@x);
1045 unshift(@x);
1046 no warnings 'syntax' ;
1047 push(@x);
1048 unshift(@x);
1049 EXPECT
1050 Useless use of push with no values at - line 4.
1051 Useless use of unshift with no values at - line 5.
1052 ########
1053 # op.c
1054 # 20020401 mjd@plover.com at suggestion of jfriedl@yahoo.com
1055 use warnings 'regexp';
1056 split /blah/g, "blah";
1057 no warnings 'regexp';
1058 split /blah/g, "blah";
1059 EXPECT
1060 Use of /g modifier is meaningless in split at - line 4.
1061 ########
1062 # op.c
1063 use warnings 'precedence';
1064 $a = $b & $c == $d;
1065 $a = $b ^ $c != $d;
1066 $a = $b | $c > $d;
1067 $a = $b < $c & $d;
1068 $a = $b >= $c ^ $d;
1069 $a = $b <= $c | $d;
1070 $a = $b <=> $c & $d;
1071 $a &= $b == $c; $a |= $b == $c; $a ^= $b == $c; # shouldn't warn
1072 no warnings 'precedence';
1073 $a = $b & $c == $d;
1074 $a = $b ^ $c != $d;
1075 $a = $b | $c > $d;
1076 $a = $b < $c & $d;
1077 $a = $b >= $c ^ $d;
1078 $a = $b <= $c | $d;
1079 $a = $b <=> $c & $d;
1080 EXPECT
1081 Possible precedence problem on bitwise & operator at - line 3.
1082 Possible precedence problem on bitwise ^ operator at - line 4.
1083 Possible precedence problem on bitwise | operator at - line 5.
1084 Possible precedence problem on bitwise & operator at - line 6.
1085 Possible precedence problem on bitwise ^ operator at - line 7.
1086 Possible precedence problem on bitwise | operator at - line 8.
1087 Possible precedence problem on bitwise & operator at - line 9.
1088 ########
1089 # op.c
1090 use integer;
1091 use warnings 'precedence';
1092 $a = $b & $c == $d;
1093 $a = $b ^ $c != $d;
1094 $a = $b | $c > $d;
1095 $a = $b < $c & $d;
1096 $a = $b >= $c ^ $d;
1097 $a = $b <= $c | $d;
1098 $a = $b <=> $c & $d;
1099 no warnings 'precedence';
1100 $a = $b & $c == $d;
1101 $a = $b ^ $c != $d;
1102 $a = $b | $c > $d;
1103 $a = $b < $c & $d;
1104 $a = $b >= $c ^ $d;
1105 $a = $b <= $c | $d;
1106 $a = $b <=> $c & $d;
1107 EXPECT
1108 Possible precedence problem on bitwise & operator at - line 4.
1109 Possible precedence problem on bitwise ^ operator at - line 5.
1110 Possible precedence problem on bitwise | operator at - line 6.
1111 Possible precedence problem on bitwise & operator at - line 7.
1112 Possible precedence problem on bitwise ^ operator at - line 8.
1113 Possible precedence problem on bitwise | operator at - line 9.
1114 Possible precedence problem on bitwise & operator at - line 10.
1115 ########
1116 # op.c
1117
1118 # ok    => local() has desired effect;
1119 # ignore=> local() silently ignored
1120
1121 use warnings 'syntax';
1122
1123 local(undef);           # OP_UNDEF              ignore
1124 sub lval : lvalue {};
1125 local(lval());          # OP_ENTERSUB
1126 local($x **= 1);        # OP_POW
1127 local($x *=  1);        # OP_MULTIPLY
1128 local($x /=  1);        # OP_DIVIDE
1129 local($x %=  1);        # OP_MODULO
1130 local($x x=  1);        # OP_REPEAT
1131 local($x +=  1);        # OP_ADD
1132 local($x -=  1);        # OP_SUBTRACT
1133 local($x .=  1);        # OP_CONCAT
1134 local($x <<= 1);        # OP_LEFT_SHIFT
1135 local($x >>= 1);        # OP_RIGHT_SHIFT
1136 local($x &=  1);        # OP_BIT_AND
1137 local($x ^=  1);        # OP_BIT_XOR
1138 local($x |=  1);        # OP_BIT_OR
1139 {
1140     use integer;
1141     local($x *= 1);     # OP_I_MULTIPLY
1142     local($x /= 1);     # OP_I_DIVIDE
1143     local($x %= 1);     # OP_I_MODULO
1144     local($x += 1);     # OP_I_ADD
1145     local($x -= 1);     # OP_I_SUBTRACT
1146 }
1147 local($x?$y:$z) = 1;    # OP_COND_EXPR          ok
1148 # these two are fatal run-time errors instead
1149 #local(@$a);            # OP_RV2AV              ok
1150 #local(%$a);            # OP_RV2HV              ok
1151 local(*a);              # OP_RV2GV              ok
1152 local(@a[1,2]);         # OP_ASLICE             ok
1153 local(@a{1,2});         # OP_HSLICE             ok
1154 local(@a = (1,2));      # OP_AASSIGN
1155 local($$x);             # OP_RV2SV              ok
1156 local($#a);             # OP_AV2ARYLEN
1157 local($x =   1);        # OP_SASSIGN
1158 local($x &&= 1);        # OP_ANDASSIGN
1159 local($x ||= 1);        # OP_ORASSIGN
1160 local($x //= 1);        # OP_DORASSIGN
1161 local($a[0]);           # OP_AELEMFAST          ok
1162
1163 local(substr($x,0,1));  # OP_SUBSTR
1164 local(pos($x));         # OP_POS
1165 local(vec($x,0,1));     # OP_VEC
1166 local($a[$b]);          # OP_AELEM              ok
1167 local($a{$b});          # OP_HELEM              ok
1168
1169 no warnings 'syntax';
1170 EXPECT
1171 Useless localization of subroutine entry at - line 10.
1172 Useless localization of exponentiation (**) at - line 11.
1173 Useless localization of multiplication (*) at - line 12.
1174 Useless localization of division (/) at - line 13.
1175 Useless localization of modulus (%) at - line 14.
1176 Useless localization of repeat (x) at - line 15.
1177 Useless localization of addition (+) at - line 16.
1178 Useless localization of subtraction (-) at - line 17.
1179 Useless localization of concatenation (.) or string at - line 18.
1180 Useless localization of left bitshift (<<) at - line 19.
1181 Useless localization of right bitshift (>>) at - line 20.
1182 Useless localization of bitwise and (&) at - line 21.
1183 Useless localization of bitwise xor (^) at - line 22.
1184 Useless localization of bitwise or (|) at - line 23.
1185 Useless localization of integer multiplication (*) at - line 26.
1186 Useless localization of integer division (/) at - line 27.
1187 Useless localization of integer modulus (%) at - line 28.
1188 Useless localization of integer addition (+) at - line 29.
1189 Useless localization of integer subtraction (-) at - line 30.
1190 Useless localization of list assignment at - line 39.
1191 Useless localization of array length at - line 41.
1192 Useless localization of scalar assignment at - line 42.
1193 Useless localization of logical and assignment (&&=) at - line 43.
1194 Useless localization of logical or assignment (||=) at - line 44.
1195 Useless localization of defined or assignment (//=) at - line 45.
1196 Useless localization of substr at - line 48.
1197 Useless localization of match position at - line 49.
1198 Useless localization of vec at - line 50.
1199 ########
1200 # op.c
1201 my $x1 if 0;
1202 my @x2 if 0;
1203 my %x3 if 0;
1204 my ($x4) if 0;
1205 my ($x5,@x6, %x7) if 0;
1206 0 && my $z1;
1207 0 && my (%z2);
1208 # these shouldn't warn
1209 our $x if 0;
1210 our $x unless 0;
1211 if (0) { my $w1 }
1212 if (my $w2) { $a=1 }
1213 if ($a && (my $w3 = 1)) {$a = 2}
1214
1215 EXPECT
1216 Deprecated use of my() in false conditional at - line 2.
1217 Deprecated use of my() in false conditional at - line 3.
1218 Deprecated use of my() in false conditional at - line 4.
1219 Deprecated use of my() in false conditional at - line 5.
1220 Deprecated use of my() in false conditional at - line 6.
1221 Deprecated use of my() in false conditional at - line 7.
1222 Deprecated use of my() in false conditional at - line 8.
1223 ########
1224 # op.c
1225 $[ = 1;
1226 ($[) = 1;
1227 use warnings 'deprecated';
1228 $[ = 2;
1229 ($[) = 2;
1230 no warnings 'deprecated';
1231 $[ = 3;
1232 ($[) = 3;
1233 EXPECT
1234 Use of assignment to $[ is deprecated at - line 2.
1235 Use of assignment to $[ is deprecated at - line 3.
1236 Use of assignment to $[ is deprecated at - line 5.
1237 Use of assignment to $[ is deprecated at - line 6.
1238 ########
1239 # op.c
1240 use warnings 'void';
1241 @x = split /y/, "z";
1242 $x = split /y/, "z";
1243      split /y/, "z";
1244 no warnings 'void';
1245 @x = split /y/, "z";
1246 $x = split /y/, "z";
1247      split /y/, "z";
1248 EXPECT
1249 Useless use of split in void context at - line 5.
1250 ########
1251 # op.c
1252 use warnings 'redefine' ;
1253 use utf8;
1254 use open qw( :utf8 :std );
1255 sub frèd {}
1256 sub frèd {}
1257 no warnings 'redefine' ;
1258 sub frèd {}
1259 EXPECT
1260 Subroutine frèd redefined at - line 6.
1261 ########
1262 # op.c
1263 use warnings 'redefine' ;
1264 use utf8;
1265 use open qw( :utf8 :std );
1266 sub frèd () { 1 }
1267 sub frèd () { 1 }
1268 no warnings 'redefine' ;
1269 sub frèd () { 1 }
1270 EXPECT
1271 Constant subroutine frèd redefined at - line 6.
1272 ########
1273 # op.c
1274 use utf8;
1275 use open qw( :utf8 :std );
1276 sub frèd () { 1 }
1277 sub frèd () { 2 }
1278 EXPECT
1279 Constant subroutine frèd redefined at - line 5.
1280 ########
1281 # op.c
1282 use utf8;
1283 use open qw( :utf8 :std );
1284 sub frèd () { 1 }
1285 *frèd = sub () { 2 };
1286 EXPECT
1287 Constant subroutine main::frèd redefined at - line 5.
1288 ########
1289 # op.c
1290 use warnings 'redefine' ;
1291 use utf8;
1292 use open qw( :utf8 :std );
1293 sub ᚠርƊ {}
1294 sub ᚠርƊ {}
1295 no warnings 'redefine' ;
1296 sub ᚠርƊ {}
1297 EXPECT
1298 Subroutine ᚠርƊ redefined at - line 6.
1299 ########
1300 # op.c
1301 use warnings 'redefine' ;
1302 use utf8;
1303 use open qw( :utf8 :std );
1304 sub ᚠርƊ () { 1 }
1305 sub ᚠርƊ () { 1 }
1306 no warnings 'redefine' ;
1307 sub ᚠርƊ () { 1 }
1308 EXPECT
1309 Constant subroutine ᚠርƊ redefined at - line 6.
1310 ########
1311 # op.c
1312 use utf8;
1313 use open qw( :utf8 :std );
1314 sub ᚠርƊ () { 1 }
1315 sub ᚠርƊ () { 2 }
1316 EXPECT
1317 Constant subroutine ᚠርƊ redefined at - line 5.
1318 ########
1319 # op.c
1320 use utf8;
1321 use open qw( :utf8 :std );
1322 sub ᚠርƊ () { 1 }
1323 *ᚠርƊ = sub () { 2 };
1324 EXPECT
1325 Constant subroutine main::ᚠርƊ redefined at - line 5.
1326 ########