This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
toke.c, S_scan_ident: Skip over newlines as well as spaces and tabs.
[perl5.git] / t / lib / warnings / toke
CommitLineData
599cee73
PM
1toke.c AOK
2
3 we seem to have lost a few ambiguous warnings!!
4
5
599cee73
PM
6 $a = <<;
7 Use of comma-less variable list is deprecated
8 (called 3 times via depcom)
9
10 \1 better written as $1
4438c4b7 11 use warnings 'syntax' ;
599cee73
PM
12 s/(abc)/\1/;
13
14 warn(warn_nosemi)
15 Semicolon seems to be missing
16 $a = 1
17 &time ;
18
19
20 Reversed %c= operator
21 my $a =+ 2 ;
22 $a =- 2 ;
23 $a =* 2 ;
24 $a =% 2 ;
25 $a =& 2 ;
26 $a =. 2 ;
27 $a =^ 2 ;
28 $a =| 2 ;
29 $a =< 2 ;
30 $a =/ 2 ;
31
32 Multidimensional syntax %.*s not supported
33 my $a = $a[1,2] ;
34
35 You need to quote \"%s\""
36 sub fred {} ; $SIG{TERM} = fred;
37
599cee73
PM
38 Can't use \\%c to mean $%c in expression
39 $_ = "ab" ; s/(ab)/\1/e;
40
41 Unquoted string "abc" may clash with future reserved word at - line 3.
42 warn(warn_reserved
43 $a = abc;
44
599cee73
PM
45 Possible attempt to separate words with commas
46 @a = qw(a, b, c) ;
47
48 Possible attempt to put comments in qw() list
49 @a = qw(a b # c) ;
50
599cee73
PM
51 %s (...) interpreted as function
52 print ("")
53 printf ("")
54 sort ("")
55
56 Ambiguous use of %c{%s%s} resolved to %c%s%s
57 $a = ${time[2]}
58 $a = ${time{2}}
59
60
61 Ambiguous use of %c{%s} resolved to %c%s
62 $a = ${time}
63 sub fred {} $a = ${fred}
64
65 Misplaced _ in number
66 $a = 1_2;
67 $a = 1_2345_6;
68
69 Bareword \"%s\" refers to nonexistent package
70 $a = FRED:: ;
71
72 Ambiguous call resolved as CORE::%s(), qualify as such or use &
73 sub time {}
74 my $a = time()
75
767a6a26
PM
76 Unrecognized escape \\%c passed through
77 $a = "\m" ;
78
820438b1 79 Useless use of \\E.
52ed07f6
BF
80 $a = "abcd\E" ;
81
767a6a26
PM
82 %s number > %s non-portable
83 my $a = 0b011111111111111111111111111111110 ;
84 $a = 0b011111111111111111111111111111111 ;
85 $a = 0b111111111111111111111111111111111 ;
86 $a = 0x0fffffffe ;
87 $a = 0x0ffffffff ;
88 $a = 0x1ffffffff ;
89 $a = 0037777777776 ;
90 $a = 0037777777777 ;
91 $a = 0047777777777 ;
92
93 Integer overflow in binary number
94 my $a = 0b011111111111111111111111111111110 ;
95 $a = 0b011111111111111111111111111111111 ;
96 $a = 0b111111111111111111111111111111111 ;
97 $a = 0x0fffffffe ;
98 $a = 0x0ffffffff ;
99 $a = 0x1ffffffff ;
100 $a = 0037777777776 ;
101 $a = 0037777777777 ;
102 $a = 0047777777777 ;
ac206dc8
RGS
103
104 dump() better written as CORE::dump()
4ac733c9
MJD
105
106 Use of /c modifier is meaningless without /g
107
64e578a2
MJD
108 Use of /c modifier is meaningless in s///
109
0453d815
PM
110 Mandatory Warnings
111 ------------------
112 Use of "%s" without parentheses is ambiguous [check_uni]
113 rand + 4
114
115 Ambiguous use of -%s resolved as -&%s() [yylex]
116 sub fred {} ; - fred ;
117
118 Precedence problem: open %.*s should be open(%.*s) [yylex]
119 open FOO || die;
120
121 Operator or semicolon missing before %c%s [yylex]
122 Ambiguous use of %c resolved as operator %c
123 *foo *foo
124
599cee73
PM
125__END__
126# toke.c
599cee73
PM
127format STDOUT =
128@<<< @||| @>>> @>>>
129$a $b "abc" 'def'
130.
4438c4b7 131no warnings 'deprecated' ;
0453d815
PM
132format STDOUT =
133@<<< @||| @>>> @>>>
134$a $b "abc" 'def'
135.
599cee73 136EXPECT
d1d15184
NC
137Use of comma-less variable list is deprecated at - line 4.
138Use of comma-less variable list is deprecated at - line 4.
139Use of comma-less variable list is deprecated at - line 4.
599cee73
PM
140########
141# toke.c
599cee73
PM
142$a = <<;
143
4438c4b7 144no warnings 'deprecated' ;
0453d815
PM
145$a = <<;
146
599cee73 147EXPECT
0da72d5e
KW
148Use of bare << to mean <<"" is deprecated at - line 2.
149########
150# toke.c
151$a =~ m/$foo/eq;
152$a =~ s/$foo/fool/seq;
153
154EXPECT
155OPTION fatal
156Unknown regexp modifier "/e" at - line 2, near "=~ "
157Unknown regexp modifier "/q" at - line 2, near "=~ "
158Unknown regexp modifier "/q" at - line 3, near "=~ "
159Execution of - aborted due to compilation errors.
84159251
BF
160########
161# toke.c
162use utf8;
163use open qw( :utf8 :std );
164$a =~ m/$foo/eネq;
165$a =~ s/$foo/fool/seネq;
166
167EXPECT
168OPTION fatal
169Unknown regexp modifier "/e" at - line 4, near "=~ "
170Unknown regexp modifier "/ネ" at - line 4, near "=~ "
171Unknown regexp modifier "/q" at - line 4, near "=~ "
172Unknown regexp modifier "/ネ" at - line 5, near "=~ "
173Unknown regexp modifier "/q" at - line 5, near "=~ "
174Execution of - aborted due to compilation errors.
599cee73
PM
175########
176# toke.c
4438c4b7 177use warnings 'syntax' ;
599cee73 178s/(abc)/\1/;
4438c4b7 179no warnings 'syntax' ;
0453d815 180s/(abc)/\1/;
599cee73
PM
181EXPECT
182\1 better written as $1 at - line 3.
183########
184# toke.c
4438c4b7 185use warnings 'semicolon' ;
599cee73
PM
186$a = 1
187&time ;
4438c4b7 188no warnings 'semicolon' ;
0453d815
PM
189$a = 1
190&time ;
599cee73
PM
191EXPECT
192Semicolon seems to be missing at - line 3.
193########
194# toke.c
4438c4b7 195use warnings 'syntax' ;
599cee73
PM
196my $a =+ 2 ;
197$a =- 2 ;
198$a =* 2 ;
199$a =% 2 ;
200$a =& 2 ;
201$a =. 2 ;
202$a =^ 2 ;
203$a =| 2 ;
204$a =< 2 ;
205$a =/ 2 ;
206EXPECT
7f01dc7a
JH
207Reversed += operator at - line 3.
208Reversed -= operator at - line 4.
209Reversed *= operator at - line 5.
210Reversed %= operator at - line 6.
211Reversed &= operator at - line 7.
212Reversed .= operator at - line 8.
213Reversed ^= operator at - line 9.
214Reversed |= operator at - line 10.
215Reversed <= operator at - line 11.
216syntax error at - line 8, near "=."
217syntax error at - line 9, near "=^"
218syntax error at - line 10, near "=|"
219Unterminated <> operator at - line 11.
599cee73
PM
220########
221# toke.c
4438c4b7 222no warnings 'syntax' ;
0453d815
PM
223my $a =+ 2 ;
224$a =- 2 ;
225$a =* 2 ;
226$a =% 2 ;
227$a =& 2 ;
228$a =. 2 ;
229$a =^ 2 ;
230$a =| 2 ;
231$a =< 2 ;
232$a =/ 2 ;
233EXPECT
7f01dc7a
JH
234syntax error at - line 8, near "=."
235syntax error at - line 9, near "=^"
236syntax error at - line 10, near "=|"
237Unterminated <> operator at - line 11.
0453d815
PM
238########
239# toke.c
4438c4b7 240use warnings 'syntax' ;
599cee73 241my $a = $a[1,2] ;
4438c4b7 242no warnings 'syntax' ;
0453d815 243my $a = $a[1,2] ;
599cee73
PM
244EXPECT
245Multidimensional syntax $a[1,2] not supported at - line 3.
246########
247# toke.c
4438c4b7 248use warnings 'syntax' ;
599cee73 249sub fred {} ; $SIG{TERM} = fred;
4438c4b7 250no warnings 'syntax' ;
0453d815 251$SIG{TERM} = fred;
599cee73
PM
252EXPECT
253You need to quote "fred" at - line 3.
254########
255# toke.c
4c01a014
BF
256use utf8;
257use open qw( :utf8 :std );
258use warnings 'syntax' ;
259sub frèd {} ; $SIG{TERM} = frèd;
260no warnings 'syntax' ;
261$SIG{TERM} = frèd;
262EXPECT
263You need to quote "frèd" at - line 5.
264########
265# toke.c
266use utf8;
267use open qw( :utf8 :std );
268use warnings 'syntax' ;
269sub ふれど {} ; $SIG{TERM} = ふれど;
270no warnings 'syntax' ;
271$SIG{TERM} = ふれど;
272EXPECT
273You need to quote "ふれど" at - line 5.
274########
275# toke.c
4438c4b7 276use warnings 'syntax' ;
599cee73
PM
277$_ = "ab" ;
278s/(ab)/\1/e;
4438c4b7 279no warnings 'syntax' ;
0453d815
PM
280$_ = "ab" ;
281s/(ab)/\1/e;
599cee73
PM
282EXPECT
283Can't use \1 to mean $1 in expression at - line 4.
284########
285# toke.c
4438c4b7 286use warnings 'reserved' ;
599cee73 287$a = abc;
1c3923b3
GS
288$a = { def
289
290=> 1 };
4438c4b7 291no warnings 'reserved' ;
0453d815 292$a = abc;
599cee73
PM
293EXPECT
294Unquoted string "abc" may clash with future reserved word at - line 3.
295########
296# toke.c
e476b1b5 297use warnings 'qw' ;
599cee73 298@a = qw(a, b, c) ;
e476b1b5 299no warnings 'qw' ;
0453d815 300@a = qw(a, b, c) ;
599cee73
PM
301EXPECT
302Possible attempt to separate words with commas at - line 3.
303########
304# toke.c
e476b1b5 305use warnings 'qw' ;
7e03b518 306@a = qw(a b c # #) ;
e476b1b5 307no warnings 'qw' ;
7e03b518 308@a = qw(a b c # #) ;
599cee73
PM
309EXPECT
310Possible attempt to put comments in qw() list at - line 3.
311########
312# toke.c
7e03b518
EB
313use warnings 'qw' ;
314@a = qw(a, b, c # #) ;
315no warnings 'qw' ;
316@a = qw(a, b, c # #) ;
317EXPECT
318Possible attempt to separate words with commas at - line 3.
319Possible attempt to put comments in qw() list at - line 3.
320########
321# toke.c
4438c4b7 322use warnings 'syntax' ;
b1439985
RGS
323print ("");
324print ("") and $x = 1;
325print ("") or die;
326print ("") // die;
327print (1+2) * 3 if 0; # only this one should warn
328print (1+2) if 0;
599cee73 329EXPECT
b1439985 330print (...) interpreted as function at - line 7.
599cee73
PM
331########
332# toke.c
4438c4b7 333no warnings 'syntax' ;
0453d815
PM
334print ("")
335EXPECT
336
337########
338# toke.c
4438c4b7 339use warnings 'syntax' ;
b1439985
RGS
340printf ("");
341printf ("") . '';
599cee73 342EXPECT
b1439985 343printf (...) interpreted as function at - line 4.
599cee73
PM
344########
345# toke.c
4438c4b7 346no warnings 'syntax' ;
0453d815
PM
347printf ("")
348EXPECT
349
350########
351# toke.c
4438c4b7 352use warnings 'syntax' ;
b1439985
RGS
353sort ("");
354sort ("") . '';
599cee73 355EXPECT
b1439985 356sort (...) interpreted as function at - line 4.
599cee73
PM
357########
358# toke.c
4438c4b7 359no warnings 'syntax' ;
0453d815
PM
360sort ("")
361EXPECT
362
363########
364# toke.c
4438c4b7 365use warnings 'ambiguous' ;
599cee73 366$a = ${time[2]};
4438c4b7 367no warnings 'ambiguous' ;
0453d815 368$a = ${time[2]};
599cee73
PM
369EXPECT
370Ambiguous use of ${time[...]} resolved to $time[...] at - line 3.
371########
372# toke.c
4438c4b7 373use warnings 'ambiguous' ;
599cee73
PM
374$a = ${time{2}};
375EXPECT
376Ambiguous use of ${time{...}} resolved to $time{...} at - line 3.
377########
378# toke.c
4438c4b7 379no warnings 'ambiguous' ;
0453d815
PM
380$a = ${time{2}};
381EXPECT
382
383########
384# toke.c
4438c4b7 385use warnings 'ambiguous' ;
599cee73 386$a = ${time} ;
27ffb73a
NC
387$a = @{time} ;
388$a = $#{time} ; # This one is special cased in toke.c
389$a = %{time} ;
390$a = *{time} ;
391$a = defined &{time} ; # To avoid calling &::time
4438c4b7 392no warnings 'ambiguous' ;
0453d815 393$a = ${time} ;
27ffb73a
NC
394$a = @{time} ;
395$a = $#{time} ; # This one is special cased in toke.c
396$a = %{time} ;
397$a = *{time} ;
398$a = defined &{time} ; # To avoid calling &::time
599cee73
PM
399EXPECT
400Ambiguous use of ${time} resolved to $time at - line 3.
27ffb73a
NC
401Ambiguous use of @{time} resolved to @time at - line 4.
402Ambiguous use of @{time} resolved to @time at - line 5.
403Ambiguous use of %{time} resolved to %time at - line 6.
404Ambiguous use of *{time} resolved to *time at - line 7.
405Ambiguous use of &{time} resolved to &time at - line 8.
599cee73
PM
406########
407# toke.c
4438c4b7 408use warnings 'ambiguous' ;
599cee73
PM
409sub fred {}
410$a = ${fred} ;
4438c4b7 411no warnings 'ambiguous' ;
0453d815 412$a = ${fred} ;
599cee73
PM
413EXPECT
414Ambiguous use of ${fred} resolved to $fred at - line 4.
415########
416# toke.c
4438c4b7 417use warnings 'syntax' ;
7fd134d9
JH
418$a = _123; print "$a\n"; #( 3 string)
419$a = 1_23; print "$a\n";
420$a = 12_3; print "$a\n";
421$a = 123_; print "$a\n"; # 6
422$a = _+123; print "$a\n"; # 7 string)
423$a = +_123; print "$a\n"; #( 8 string)
424$a = +1_23; print "$a\n";
425$a = +12_3; print "$a\n";
426$a = +123_; print "$a\n"; # 11
427$a = _-123; print "$a\n"; #(12 string)
428$a = -_123; print "$a\n"; #(13 string)
429$a = -1_23; print "$a\n";
430$a = -12_3; print "$a\n";
431$a = -123_; print "$a\n"; # 16
432$a = 123._456; print "$a\n"; # 17
433$a = 123.4_56; print "$a\n";
434$a = 123.45_6; print "$a\n";
435$a = 123.456_; print "$a\n"; # 20
436$a = +123._456; print "$a\n"; # 21
437$a = +123.4_56; print "$a\n";
438$a = +123.45_6; print "$a\n";
439$a = +123.456_; print "$a\n"; # 24
440$a = -123._456; print "$a\n"; # 25
441$a = -123.4_56; print "$a\n";
442$a = -123.45_6; print "$a\n";
443$a = -123.456_; print "$a\n"; # 28
2bea9a37
JH
444$a = 123.456E_12; printf("%.0f\n", $a); # 29
445$a = 123.456E1_2; printf("%.0f\n", $a);
446$a = 123.456E12_; printf("%.0f\n", $a); # 31
447$a = 123.456E_+12; printf("%.0f\n", $a); # 32
448$a = 123.456E+_12; printf("%.0f\n", $a); # 33
449$a = 123.456E+1_2; printf("%.0f\n", $a);
450$a = 123.456E+12_; printf("%.0f\n", $a); # 35
7fd134d9
JH
451$a = 123.456E_-12; print "$a\n"; # 36
452$a = 123.456E-_12; print "$a\n"; # 37
453$a = 123.456E-1_2; print "$a\n";
454$a = 123.456E-12_; print "$a\n"; # 39
b3b48e3e
JH
455$a = 1__23; print "$a\n"; # 40
456$a = 12.3__4; print "$a\n"; # 41
2bea9a37 457$a = 12.34e1__2; printf("%.0f\n", $a); # 42
4438c4b7 458no warnings 'syntax' ;
7fd134d9
JH
459$a = _123; print "$a\n";
460$a = 1_23; print "$a\n";
461$a = 12_3; print "$a\n";
462$a = 123_; print "$a\n";
463$a = _+123; print "$a\n";
464$a = +_123; print "$a\n";
465$a = +1_23; print "$a\n";
466$a = +12_3; print "$a\n";
467$a = +123_; print "$a\n";
468$a = _-123; print "$a\n";
469$a = -_123; print "$a\n";
470$a = -1_23; print "$a\n";
471$a = -12_3; print "$a\n";
472$a = -123_; print "$a\n";
473$a = 123._456; print "$a\n";
474$a = 123.4_56; print "$a\n";
475$a = 123.45_6; print "$a\n";
476$a = 123.456_; print "$a\n";
477$a = +123._456; print "$a\n";
478$a = +123.4_56; print "$a\n";
479$a = +123.45_6; print "$a\n";
480$a = +123.456_; print "$a\n";
481$a = -123._456; print "$a\n";
482$a = -123.4_56; print "$a\n";
483$a = -123.45_6; print "$a\n";
484$a = -123.456_; print "$a\n";
2bea9a37
JH
485$a = 123.456E_12; printf("%.0f\n", $a);
486$a = 123.456E1_2; printf("%.0f\n", $a);
487$a = 123.456E12_; printf("%.0f\n", $a);
488$a = 123.456E_+12; printf("%.0f\n", $a);
489$a = 123.456E+_12; printf("%.0f\n", $a);
490$a = 123.456E+1_2; printf("%.0f\n", $a);
491$a = 123.456E+12_; printf("%.0f\n", $a);
7fd134d9
JH
492$a = 123.456E_-12; print "$a\n";
493$a = 123.456E-_12; print "$a\n";
494$a = 123.456E-1_2; print "$a\n";
495$a = 123.456E-12_; print "$a\n";
b3b48e3e
JH
496$a = 1__23; print "$a\n";
497$a = 12.3__4; print "$a\n";
2bea9a37 498$a = 12.34e1__2; printf("%.0f\n", $a);
599cee73 499EXPECT
fbfa96bd 500OPTIONS regex
928753ea 501Misplaced _ in number at - line 6.
928753ea 502Misplaced _ in number at - line 11.
7fd134d9 503Misplaced _ in number at - line 16.
928753ea 504Misplaced _ in number at - line 17.
7fd134d9 505Misplaced _ in number at - line 20.
928753ea 506Misplaced _ in number at - line 21.
7fd134d9
JH
507Misplaced _ in number at - line 24.
508Misplaced _ in number at - line 25.
509Misplaced _ in number at - line 28.
510Misplaced _ in number at - line 29.
511Misplaced _ in number at - line 31.
512Misplaced _ in number at - line 32.
513Misplaced _ in number at - line 33.
514Misplaced _ in number at - line 35.
515Misplaced _ in number at - line 36.
516Misplaced _ in number at - line 37.
517Misplaced _ in number at - line 39.
b3b48e3e
JH
518Misplaced _ in number at - line 40.
519Misplaced _ in number at - line 41.
520Misplaced _ in number at - line 42.
928753ea
JH
521_123
522123
928753ea 523123
7fd134d9
JH
524123
525123
526_123
527123
528123
529123
530-123
531-_123
532-123
533-123
534-123
535123.456
536123.456
537123.456
538123.456
539123.456
540123.456
541123.456
542123.456
543-123.456
544-123.456
545-123.456
546-123.456
547123456000000000
548123456000000000
549123456000000000
550123456000000000
551123456000000000
552123456000000000
553123456000000000
fbfa96bd
NIS
5541.23456e-0?10
5551.23456e-0?10
5561.23456e-0?10
5571.23456e-0?10
b3b48e3e
JH
558123
55912.34
56012340000000000
7fd134d9
JH
561_123
562123
563123
564123
565123
566_123
567123
568123
569123
570-123
571-_123
572-123
573-123
574-123
575123.456
576123.456
577123.456
578123.456
579123.456
928753ea
JH
580123.456
581123.456
928753ea 582123.456
7fd134d9
JH
583-123.456
584-123.456
585-123.456
586-123.456
587123456000000000
588123456000000000
589123456000000000
590123456000000000
591123456000000000
592123456000000000
593123456000000000
fbfa96bd
NIS
5941.23456e-0?10
5951.23456e-0?10
5961.23456e-0?10
5971.23456e-0?10
b3b48e3e
JH
598123
59912.34
60012340000000000
599cee73
PM
601########
602# toke.c
e476b1b5 603use warnings 'bareword' ;
60e6418e 604#line 25 "bar"
599cee73 605$a = FRED:: ;
e476b1b5 606no warnings 'bareword' ;
0453d815
PM
607#line 25 "bar"
608$a = FRED:: ;
599cee73 609EXPECT
60e6418e 610Bareword "FRED::" refers to nonexistent package at bar line 25.
979a1401
BF
611########
612# toke.c
613use utf8;
614use open qw( :utf8 :std );
615use warnings 'bareword' ;
616#line 25 "bar"
617$a = FRÈD:: ;
618no warnings 'bareword' ;
619#line 25 "bar"
620$a = FRÈD:: ;
621EXPECT
622Bareword "FRÈD::" refers to nonexistent package at bar line 25.
623########
624# toke.c
625use utf8;
626use open qw( :utf8 :std );
627use warnings 'bareword' ;
628#line 25 "bar"
629$a = ϞϞϞ:: ;
630no warnings 'bareword' ;
631#line 25 "bar"
632$a = ϞϞϞ:: ;
633EXPECT
634Bareword "ϞϞϞ::" refers to nonexistent package at bar line 25.
599cee73
PM
635########
636# toke.c
4438c4b7 637use warnings 'ambiguous' ;
599cee73 638sub time {}
0453d815 639my $a = time() ;
4438c4b7 640no warnings 'ambiguous' ;
0453d815 641my $b = time() ;
599cee73
PM
642EXPECT
643Ambiguous call resolved as CORE::time(), qualify as such or use & at - line 4.
644########
645# toke.c
26d16222 646use warnings ;
0453d815 647eval <<'EOE';
df0deb90
GS
648# line 30 "foo"
649warn "yelp";
0453d815 650{
0453d815
PM
651 $_ = " \x{123} " ;
652}
653EOE
654EXPECT
df0deb90 655yelp at foo line 30.
0453d815
PM
656########
657# toke.c
0453d815 658my $a = rand + 4 ;
fbdd83da
DIM
659$a = rand *^H ;
660$a = rand $^H ;
0453d815 661EXPECT
2d5ccbba 662Warning: Use of "rand" without parentheses is ambiguous at - line 2.
0453d815
PM
663########
664# toke.c
665$^W = 0 ;
666my $a = rand + 4 ;
667{
4438c4b7 668 no warnings 'ambiguous' ;
0453d815 669 $a = rand + 4 ;
4438c4b7 670 use warnings 'ambiguous' ;
0453d815
PM
671 $a = rand + 4 ;
672}
673$a = rand + 4 ;
674EXPECT
2d5ccbba
IT
675Warning: Use of "rand" without parentheses is ambiguous at - line 3.
676Warning: Use of "rand" without parentheses is ambiguous at - line 8.
677Warning: Use of "rand" without parentheses is ambiguous at - line 10.
0453d815 678########
e19a021b
FC
679# [perl #97110]
680sub myrand(;$) { }
b5fb7ce3 681sub whatever($) { }
e19a021b 682my $a = myrand + 4 ;
b5fb7ce3 683my $b = whatever + 4 ;
e19a021b 684EXPECT
b5fb7ce3 685Warning: Use of "myrand" without parentheses is ambiguous at - line 4.
e19a021b 686########
0453d815 687# toke.c
e8ae98db
RGS
688use warnings "ambiguous";
689print for keys %+; # should not warn
690EXPECT
691########
692# toke.c
0453d815
PM
693sub fred {};
694-fred ;
898c3bca
FC
695sub hank : lvalue {$_}
696--hank; # This should *not* warn [perl #77240]
0453d815
PM
697EXPECT
698Ambiguous use of -fred resolved as -&fred() at - line 3.
699########
700# toke.c
701$^W = 0 ;
702sub fred {} ;
703-fred ;
704{
4438c4b7 705 no warnings 'ambiguous' ;
0453d815 706 -fred ;
4438c4b7 707 use warnings 'ambiguous' ;
0453d815
PM
708 -fred ;
709}
710-fred ;
711EXPECT
712Ambiguous use of -fred resolved as -&fred() at - line 4.
713Ambiguous use of -fred resolved as -&fred() at - line 9.
714Ambiguous use of -fred resolved as -&fred() at - line 11.
715########
716# toke.c
43b5ab4c
BF
717use utf8;
718use open qw( :utf8 :std );
719sub frèd {};
720-frèd ;
721EXPECT
722Ambiguous use of -frèd resolved as -&frèd() at - line 5.
723########
724# toke.c
725$^W = 0 ;
726use utf8;
727use open qw( :utf8 :std );
728sub frèd {} ;
729-frèd ;
730{
731 no warnings 'ambiguous' ;
732 -frèd ;
733 use warnings 'ambiguous' ;
734 -frèd ;
735}
736-frèd ;
737EXPECT
738Ambiguous use of -frèd resolved as -&frèd() at - line 6.
739Ambiguous use of -frèd resolved as -&frèd() at - line 11.
740Ambiguous use of -frèd resolved as -&frèd() at - line 13.
741########
742# toke.c
743use utf8;
744use open qw( :utf8 :std );
745sub ᒍᒘᒊ {};
746-ᒍᒘᒊ ;
747EXPECT
748Ambiguous use of -ᒍᒘᒊ resolved as -&ᒍᒘᒊ() at - line 5.
749########
750# toke.c
751$^W = 0 ;
752use utf8;
753use open qw( :utf8 :std );
754sub ᒍᒘᒊ {} ;
755-ᒍᒘᒊ ;
756{
757 no warnings 'ambiguous' ;
758 -ᒍᒘᒊ ;
759 use warnings 'ambiguous' ;
760 -ᒍᒘᒊ ;
761}
762-ᒍᒘᒊ ;
763EXPECT
764Ambiguous use of -ᒍᒘᒊ resolved as -&ᒍᒘᒊ() at - line 6.
765Ambiguous use of -ᒍᒘᒊ resolved as -&ᒍᒘᒊ() at - line 11.
766Ambiguous use of -ᒍᒘᒊ resolved as -&ᒍᒘᒊ() at - line 13.
767########
768# toke.c
0453d815 769open FOO || time;
240d1b6f 770open local *FOO; # should be ok
0453d815
PM
771EXPECT
772Precedence problem: open FOO should be open(FOO) at - line 2.
773########
71aa9713
BF
774# toke.c
775use utf8;
776use open qw( :utf8 :std );
777open FÒÒ || time;
778EXPECT
779Precedence problem: open FÒÒ should be open(FÒÒ) at - line 4.
780########
781# toke.c
782use utf8;
783use open qw( :utf8 :std );
784open ᒍOO || time;
785EXPECT
786Precedence problem: open ᒍOO should be open(ᒍOO) at - line 4.
787########
66fbe8fb
HS
788# toke.c (and [perl #16184])
789open FOO => "<&0"; close FOO;
790EXPECT
791########
0453d815
PM
792# toke.c
793$^W = 0 ;
794open FOO || time;
795{
e476b1b5 796 no warnings 'precedence' ;
0453d815 797 open FOO || time;
e476b1b5 798 use warnings 'precedence' ;
0453d815
PM
799 open FOO || time;
800}
801open FOO || time;
db3abe52 802open Foo::BAR; # this should not warn
0453d815
PM
803EXPECT
804Precedence problem: open FOO should be open(FOO) at - line 3.
805Precedence problem: open FOO should be open(FOO) at - line 8.
806Precedence problem: open FOO should be open(FOO) at - line 10.
807########
808# toke.c
809$^W = 0 ;
71aa9713
BF
810use utf8;
811use open qw( :utf8 :std );
812open FÒÒ || time;
813{
814 no warnings 'precedence' ;
815 open FÒÒ || time;
816 use warnings 'precedence' ;
817 open FÒÒ || time;
818}
819open FÒÒ || time;
820EXPECT
821Precedence problem: open FÒÒ should be open(FÒÒ) at - line 5.
822Precedence problem: open FÒÒ should be open(FÒÒ) at - line 10.
823Precedence problem: open FÒÒ should be open(FÒÒ) at - line 12.
824########
825# toke.c
826use utf8;
827use open qw( :utf8 :std );
828$^W = 0 ;
829open ᒍÒÒ || time;
830{
831 no warnings 'precedence' ;
832 open ᒍÒÒ || time;
833 use warnings 'precedence' ;
834 open ᒍÒÒ || time;
835}
836open ᒍÒÒ || time;
837EXPECT
838Precedence problem: open ᒍÒÒ should be open(ᒍÒÒ) at - line 5.
839Precedence problem: open ᒍÒÒ should be open(ᒍÒÒ) at - line 10.
840Precedence problem: open ᒍÒÒ should be open(ᒍÒÒ) at - line 12.
841########
842# toke.c
843$^W = 0 ;
0453d815
PM
844*foo *foo ;
845{
4438c4b7 846 no warnings 'ambiguous' ;
0453d815 847 *foo *foo ;
4438c4b7 848 use warnings 'ambiguous' ;
0453d815
PM
849 *foo *foo ;
850}
851*foo *foo ;
9700e2d3
FC
852# These should not warn [perl #117535]:
853foo**foo ;
854no warnings 'deprecated';
855sort $*foo ;
856sort $ *foo ;
0453d815
PM
857EXPECT
858Operator or semicolon missing before *foo at - line 3.
859Ambiguous use of * resolved as operator * at - line 3.
860Operator or semicolon missing before *foo at - line 8.
861Ambiguous use of * resolved as operator * at - line 8.
862Operator or semicolon missing before *foo at - line 10.
863Ambiguous use of * resolved as operator * at - line 10.
767a6a26
PM
864########
865# toke.c
9700e2d3
FC
866$^W = 0 ;
867%foo %foo ;
868{
869 no warnings 'ambiguous' ;
870 %foo %foo ;
871 use warnings 'ambiguous' ;
872 %foo %foo ;
873}
874%foo %foo ;
875# This should not produce ambiguity warnings [perl #117535]:
876sort $%foo ;
877sort $ %foo ;
878EXPECT
879Operator or semicolon missing before %foo at - line 3.
880Ambiguous use of % resolved as operator % at - line 3.
881Operator or semicolon missing before %foo at - line 8.
882Ambiguous use of % resolved as operator % at - line 8.
883Operator or semicolon missing before %foo at - line 10.
884Ambiguous use of % resolved as operator % at - line 10.
885Bareword found where operator expected at - line 12, near "$%foo"
886 (Missing operator before foo?)
887Bareword found where operator expected at - line 13, near "$ %foo"
888 (Missing operator before foo?)
889Illegal modulus zero at - line 3.
890########
891# toke.c
892$^W = 0 ;
893&foo &foo ;
894{
895 no warnings 'ambiguous' ;
896 &foo &foo ;
897 use warnings 'ambiguous' ;
898 &foo &foo ;
899}
900&foo &foo ;
901# These should not warn produce ambiguity warnings [perl #76910]:
902foo&&foo ;
903sort $&foo ;
904sort $ &foo ;
905EXPECT
906Operator or semicolon missing before &foo at - line 3.
907Ambiguous use of & resolved as operator & at - line 3.
908Operator or semicolon missing before &foo at - line 8.
909Ambiguous use of & resolved as operator & at - line 8.
910Operator or semicolon missing before &foo at - line 10.
911Ambiguous use of & resolved as operator & at - line 10.
912Bareword found where operator expected at - line 13, near "$&foo"
913 (Missing operator before foo?)
914Bareword found where operator expected at - line 14, near "$ &foo"
915 (Missing operator before foo?)
916Undefined subroutine &main::foo called at - line 3.
917########
918# toke.c
02571fe8
BF
919use utf8;
920use open qw( :utf8 :std );
921$^W = 0 ;
922*foo *foo ;
923{
924 no warnings 'ambiguous' ;
925 *foo *foo ;
926 use warnings 'ambiguous' ;
927 *foo *foo ;
928}
929*foo *foo ;
930EXPECT
931Operator or semicolon missing before *foo at - line 5.
932Ambiguous use of * resolved as operator * at - line 5.
933Operator or semicolon missing before *foo at - line 10.
934Ambiguous use of * resolved as operator * at - line 10.
935Operator or semicolon missing before *foo at - line 12.
936Ambiguous use of * resolved as operator * at - line 12.
937########
938# toke.c
e476b1b5 939use warnings 'misc' ;
767a6a26 940my $a = "\m" ;
e476b1b5 941no warnings 'misc' ;
767a6a26
PM
942$a = "\m" ;
943EXPECT
944Unrecognized escape \m passed through at - line 3.
945########
946# toke.c
52ed07f6
BF
947use warnings 'misc' ;
948my $a = "abcd\E" ;
949no warnings 'misc' ;
950$a = "abcd\E" ;
951EXPECT
820438b1 952Useless use of \E at - line 3.
52ed07f6
BF
953########
954# toke.c
767a6a26
PM
955use warnings 'portable' ;
956my $a = 0b011111111111111111111111111111110 ;
957 $a = 0b011111111111111111111111111111111 ;
958 $a = 0b111111111111111111111111111111111 ;
959 $a = 0x0fffffffe ;
960 $a = 0x0ffffffff ;
961 $a = 0x1ffffffff ;
962 $a = 0037777777776 ;
963 $a = 0037777777777 ;
964 $a = 0047777777777 ;
965no warnings 'portable' ;
966 $a = 0b011111111111111111111111111111110 ;
967 $a = 0b011111111111111111111111111111111 ;
968 $a = 0b111111111111111111111111111111111 ;
969 $a = 0x0fffffffe ;
970 $a = 0x0ffffffff ;
971 $a = 0x1ffffffff ;
972 $a = 0037777777776 ;
973 $a = 0037777777777 ;
974 $a = 0047777777777 ;
975EXPECT
976Binary number > 0b11111111111111111111111111111111 non-portable at - line 5.
977Hexadecimal number > 0xffffffff non-portable at - line 8.
978Octal number > 037777777777 non-portable at - line 11.
979########
980# toke.c
981use warnings 'overflow' ;
982my $a = 0b011111111111111111111111111111110 ;
983 $a = 0b011111111111111111111111111111111 ;
15041a67 984 $a = 0b10000000000000000000000000000000000000000000000000000000000000000 ;
767a6a26
PM
985 $a = 0x0fffffffe ;
986 $a = 0x0ffffffff ;
15041a67 987 $a = 0x10000000000000000 ;
767a6a26
PM
988 $a = 0037777777776 ;
989 $a = 0037777777777 ;
15041a67 990 $a = 002000000000000000000000;
767a6a26
PM
991no warnings 'overflow' ;
992 $a = 0b011111111111111111111111111111110 ;
993 $a = 0b011111111111111111111111111111111 ;
15041a67 994 $a = 0b10000000000000000000000000000000000000000000000000000000000000000 ;
767a6a26
PM
995 $a = 0x0fffffffe ;
996 $a = 0x0ffffffff ;
15041a67 997 $a = 0x10000000000000000 ;
767a6a26
PM
998 $a = 0037777777776 ;
999 $a = 0037777777777 ;
15041a67 1000 $a = 002000000000000000000000;
767a6a26
PM
1001EXPECT
1002Integer overflow in binary number at - line 5.
1003Integer overflow in hexadecimal number at - line 8.
1004Integer overflow in octal number at - line 11.
8593bda5
GS
1005########
1006# toke.c
ac206dc8
RGS
1007BEGIN { $^C = 1; }
1008use warnings 'misc';
1009dump;
1010CORE::dump;
1011EXPECT
1012dump() better written as CORE::dump() at - line 4.
1013- syntax OK
1014########
1015# toke.c
1016use warnings 'misc';
1017use subs qw/dump/;
93f09d7b 1018sub dump { print "no warning for overridden dump\n"; }
ac206dc8
RGS
1019dump;
1020EXPECT
93f09d7b 1021no warning for overridden dump
ac206dc8
RGS
1022########
1023# toke.c
8593bda5
GS
1024use warnings 'ambiguous';
1025"@mjd_previously_unused_array";
1026no warnings 'ambiguous';
29fb1d0e 1027"@mjd_previously_unused_array2";
8593bda5
GS
1028EXPECT
1029Possible unintended interpolation of @mjd_previously_unused_array in string at - line 3.
707afd92
MS
1030########
1031# toke.c
29fb1d0e
BF
1032use utf8;
1033use open qw( :utf8 :std );
1034use warnings 'ambiguous';
1035"@mjd_previously_unused_àrray";
1036no warnings 'ambiguous';
1037"@mjd_previously_unused_àrray2";
1038EXPECT
1039Possible unintended interpolation of @mjd_previously_unused_àrray in string at - line 5.
1040########
1041# toke.c
1042use utf8;
1043use open qw( :utf8 :std );
1044use warnings 'ambiguous';
1045"@mjd_previously_unused_ぁrrぁy";
1046no warnings 'ambiguous';
1047"@mjd_previously_unused_ぁrrぁy2";
1048EXPECT
1049Possible unintended interpolation of @mjd_previously_unused_ぁrrぁy in string at - line 5.
1050########
1051# toke.c
d8c55666 1052# 20020328 mjd-perl-patch+@plover.com at behest of jfriedl@yahoo.com
4ac733c9
MJD
1053use warnings 'regexp';
1054"foo" =~ /foo/c;
64e578a2 1055"foo" =~ /foo/cg;
4ac733c9
MJD
1056no warnings 'regexp';
1057"foo" =~ /foo/c;
64e578a2 1058"foo" =~ /foo/cg;
4ac733c9
MJD
1059EXPECT
1060Use of /c modifier is meaningless without /g at - line 4.
1061########
1062# toke.c
d8c55666 1063# 20020328 mjd-perl-patch+@plover.com at behest of jfriedl@yahoo.com
4ac733c9
MJD
1064use warnings 'regexp';
1065$_ = "ab" ;
1066s/ab/ab/c;
64e578a2 1067s/ab/ab/cg;
4ac733c9
MJD
1068no warnings 'regexp';
1069s/ab/ab/c;
64e578a2 1070s/ab/ab/cg;
4ac733c9 1071EXPECT
64e578a2
MJD
1072Use of /c modifier is meaningless in s/// at - line 5.
1073Use of /c modifier is meaningless in s/// at - line 6.
d8c55666
MJD
1074########
1075-wa
1076# toke.c
1077# 20020414 mjd-perl-patch+@plover.com # -a flag should suppress these warnings
1078print "@F\n";
1079EXPECT
1080
1081########
1082-w
1083# toke.c
1084# 20020414 mjd-perl-patch+@plover.com # -a flag should suppress these warnings
1085print "@F\n";
1086EXPECT
1087Possible unintended interpolation of @F in string at - line 4.
1088Name "main::F" used only once: possible typo at - line 4.
1089########
1090-wa
1091# toke.c
1092# 20020414 mjd-perl-patch+@plover.com
1093EXPECT
1094
2710853f
MJD
1095########
1096# toke.c
1097# 20020414 mjd-perl-patch+@plover.com
1098# In 5.7.3, this emitted "Possible unintended interpolation" warnings
1099use warnings 'ambiguous';
1100$s = "(@-)(@+)";
1101EXPECT
1102
56da5a46
RGS
1103########
1104# toke.c
1105# mandatory warning
1106eval q/if ($a) { } elseif ($b) { }/;
1107no warnings "syntax";
1108eval q/if ($a) { } elseif ($b) { }/;
1109EXPECT
1110elseif should be elsif at (eval 1) line 1.
1111########
1112# toke.c
1113# mandatory warning
1114eval q/5 6/;
1115no warnings "syntax";
1116eval q/5 6/;
1117EXPECT
1118Number found where operator expected at (eval 1) line 1, near "5 6"
1119 (Missing operator before 6?)
984200d0
YST
1120########
1121# toke.c
7fc874e8 1122use warnings "syntax"; no warnings "deprecated";
984200d0
YST
1123$_ = $a = 1;
1124$a !=~ /1/;
1125$a !=~ m#1#;
1126$a !=~/1/;
1127$a !=~ ?/?;
decca21c
YST
1128$a !=~ y/1//;
1129$a !=~ tr/1//;
1130$a !=~ s/1//;
984200d0
YST
1131$a != ~/1/;
1132no warnings "syntax";
1133$a !=~ /1/;
1134$a !=~ m#1#;
1135$a !=~/1/;
1136$a !=~ ?/?;
decca21c
YST
1137$a !=~ y/1//;
1138$a !=~ tr/1//;
1139$a !=~ s/1//;
984200d0
YST
1140EXPECT
1141!=~ should be !~ at - line 4.
1142!=~ should be !~ at - line 5.
1143!=~ should be !~ at - line 6.
1144!=~ should be !~ at - line 7.
decca21c
YST
1145!=~ should be !~ at - line 8.
1146!=~ should be !~ at - line 9.
1147!=~ should be !~ at - line 10.
1108974d
RGS
1148########
1149# toke.c
1150our $foo :unique;
8e5dadda
NC
1151sub pam :locked;
1152sub glipp :locked {
1153}
1154sub whack_eth ($) : locked {
1155}
d1d15184 1156no warnings 'deprecated';
1108974d 1157our $bar :unique;
8e5dadda
NC
1158sub zapeth :locked;
1159sub ker_plop :locked {
1160}
1161sub swa_a_p ($) : locked {
1162}
1108974d 1163EXPECT
d1d15184
NC
1164Use of :unique is deprecated at - line 2.
1165Use of :locked is deprecated at - line 3.
1166Use of :locked is deprecated at - line 4.
1167Use of :locked is deprecated at - line 6.
9e8d7757
RB
1168########
1169# toke.c
e7d0b801 1170use warnings "syntax"; use feature 'lexical_subs';
9e8d7757
RB
1171sub proto_after_array(@$);
1172sub proto_after_arref(\@$);
1173sub proto_after_arref2(\[@$]);
1174sub proto_after_arref3(\[@$]_);
1175sub proto_after_hash(%$);
1176sub proto_after_hashref(\%$);
1177sub proto_after_hashref2(\[%$]);
1178sub underscore_last_pos($_);
1179sub underscore2($_;$);
1180sub underscore_fail($_$);
1181sub underscore_after_at(@_);
689aac7b
FC
1182our sub hour (@$);
1183my sub migh (@$);
e7d0b801 1184use feature 'state';
689aac7b
FC
1185state sub estate (@$);
1186package other;
1187sub hour (@$);
1188sub migh (@$);
1189sub estate (@$);
9e8d7757
RB
1190no warnings "syntax";
1191sub proto_after_array(@$);
1192sub proto_after_hash(%$);
1193sub underscore_fail($_$);
1194EXPECT
1195Prototype after '@' for main::proto_after_array : @$ at - line 3.
1196Prototype after '%' for main::proto_after_hash : %$ at - line 7.
aef2a98a 1197Illegal character after '_' in prototype for main::underscore_fail : $_$ at - line 12.
9e8d7757 1198Prototype after '@' for main::underscore_after_at : @_ at - line 13.
64fbf0dd 1199The lexical_subs feature is experimental at - line 14.
689aac7b 1200Prototype after '@' for hour : @$ at - line 14.
64fbf0dd 1201The lexical_subs feature is experimental at - line 15.
689aac7b 1202Prototype after '@' for migh : @$ at - line 15.
64fbf0dd 1203The lexical_subs feature is experimental at - line 17.
689aac7b
FC
1204Prototype after '@' for estate : @$ at - line 17.
1205Prototype after '@' for hour : @$ at - line 19.
1206Prototype after '@' for migh : @$ at - line 20.
1207Prototype after '@' for estate : @$ at - line 21.
77772344
B
1208########
1209# toke.c
1210use warnings "ambiguous";
1211"foo\nn" =~ /^foo$\n/;
1212"foo\nn" =~ /^foo${\}n/;
1213my $foo = qr/^foo$\n/;
1214my $bar = qr/^foo${\}n/;
1215no warnings "ambiguous";
1216"foo\nn" =~ /^foo$\n/;
1217"foo\nn" =~ /^foo${\}n/;
1218my $foo = qr/^foo$\n/;
1219my $bar = qr/^foo${\}n/;
1220EXPECT
1221Possible unintended interpolation of $\ in regex at - line 3.
1222Possible unintended interpolation of $\ in regex at - line 5.
d83f38d8
NC
1223########
1224# toke.c
f0a2b745
KW
1225use warnings 'syntax' ;
1226my $a = "\o";
1227my $a = "\o{";
1228my $a = "\o{}";
1229no warnings 'syntax' ;
1230my $a = "\o";
1231my $a = "\o{";
1232my $a = "\o{}";
1233EXPECT
1234Missing braces on \o{} at - line 3, within string
1235Missing right brace on \o{ at - line 4, within string
1236Number with no digits at - line 5, within string
1237BEGIN not safe after errors--compilation aborted at - line 6.
1238########
1239# toke.c
1240use warnings 'digit' ;
1241my $a = "\o{1238456}";
1242no warnings 'digit' ;
1243my $a = "\o{1238456}";
1244EXPECT
1245Non-octal character '8'. Resolved as "\o{123}" at - line 3.
725a61d7
Z
1246########
1247# toke.c
1248use warnings;
1249my $a = "foo";
1250print $a =~ ?f? ? "yes\n" : "no\n" foreach 0..2;
1251EXPECT
1252Use of ?PATTERN? without explicit operator is deprecated at - line 4.
1253yes
1254no
1255no
17a3df4c
KW
1256########
1257# toke.c
1258use warnings;
1259my $a = "\c{ack}";
1260$a = "\c,";
1261$a = "\c`";
1262no warnings 'syntax';
1263$a = "\c{ack}";
1264$a = "\c,";
1265$a = "\c`";
1266no warnings 'deprecated';
1267EXPECT
1268"\c{" is deprecated and is more clearly written as ";" at - line 3.
1269"\c," is more clearly written simply as "l" at - line 4.
1270"\c`" is more clearly written simply as "\ " at - line 5.
1271"\c{" is deprecated and is more clearly written as ";" at - line 7.
3955e1a9
KW
1272########
1273# toke.c
1274use warnings 'syntax' ;
1275my $a = qr/foo/du;
ff3f26d2 1276$a = qr/foo/lai;
3955e1a9 1277$a = qr/foo/lil;
ff3f26d2
KW
1278$a = qr/foo/aia;
1279$a = qr/foo/aaia;
3955e1a9
KW
1280no warnings 'syntax' ;
1281my $a = qr/foo/du;
1282EXPECT
1283Regexp modifiers "/d" and "/u" are mutually exclusive at - line 3, near "= "
1284Regexp modifiers "/l" and "/a" are mutually exclusive at - line 4, near "= "
1285Regexp modifier "/l" may not appear twice at - line 5, near "= "
ff3f26d2
KW
1286Regexp modifier "/a" may appear a maximum of twice at - line 7, near "= "
1287BEGIN not safe after errors--compilation aborted at - line 8.
ba05d9aa
FC
1288########
1289# toke.c
1290# [perl #4362]
1291eval "print q\xabfoo";
1292print "ok\n" if
1293 $@ =~ /Can't find string terminator "\xab" anywhere before EOF/;
1294EXPECT
1295ok
5c66c3dd
BF
1296########
1297# toke.c
1298use utf8;
1299use open qw( :utf8 :std );
1300use warnings 'ambiguous' ;
1301sub frèd {}
1302$a = ${frèd} ;
1303no warnings 'ambiguous' ;
1304$a = ${frèd} ;
1305EXPECT
1306Ambiguous use of ${frèd} resolved to $frèd at - line 6.
1307########
1308# toke.c
1309use utf8;
1310use open qw( :utf8 :std );
1311use warnings 'ambiguous' ;
1312sub f렏 {}
1313$a = ${f렏} ;
1314no warnings 'ambiguous' ;
1315$a = ${f렏} ;
1316EXPECT
1317Ambiguous use of ${f렏} resolved to $f렏 at - line 6.
3773592b
BF
1318########
1319# toke.c
1320use utf8;
1321use open qw( :utf8 :std );
1322use warnings;
1323CORE::렏;
1324EXPECT
1325CORE::렏 is not a keyword at - line 5.
5dc13276
MH
1326########
1327# toke.c
1328# [perl #16249]
1329print '';
1330eval this_method_is_fake ();
1331EXPECT
1332Undefined subroutine &main::this_method_is_fake called at - line 4.
a71a1afb
FC
1333########
1334# toke.c
1335# [perl #107002] Erroneous ambiguity warnings
1336sub { # do not actually call require
1337 require a::b . 1; # These used to produce erroneous
1338 require a::b + 1; # ambiguity warnings.
1339}
1340EXPECT
4d68ffa0
KW
1341########
1342# toke.c
70502ce0 1343# [perl #113094], [perl #119101]
4d68ffa0
KW
1344print "aa" =~ m{^a\{1,2\}$}, "\n";
1345print "aa" =~ m{^a\x\{61\}$}, "\n";
70502ce0
KW
1346print "a\\x{6F}" =~ m{^a\\x\{6F\}$}, "\n";
1347print "a\\o" =~ m{^a\\\x\{6F\}$}, "\n";
1348print "a\\\\x{6F}" =~ m{^a\\\\x\{6F\}$}, "\n";
1349print "a\\\\o" =~ m{^a\\\\\x\{6F\}$}, "\n";
4d68ffa0
KW
1350print "aa" =~ m{^a{1,2}$}, "\n";
1351print "aq" =~ m[^a\[a-z\]$], "\n";
1352print "aq" =~ m(^a\(q\)$), "\n";
1353no warnings 'deprecated';
1354print "aa" =~ m{^a\{1,2\}$}, "\n";
1355print "aa" =~ m{^a\x\{61\}$}, "\n";
70502ce0
KW
1356print "a\\x{6F}" =~ m{^a\\x\{6F\}$}, "\n";
1357print "a\\o" =~ m{^a\\\x\{6f\}$}, "\n";
4d68ffa0
KW
1358print "aq" =~ m[^a\[a-z\]$], "\n";
1359print "aq" =~ m(^a\(q\)$), "\n";
1360EXPECT
1361Useless use of '\'; doesn't escape metacharacter '{' at - line 3.
1362Useless use of '\'; doesn't escape metacharacter '{' at - line 4.
70502ce0
KW
1363Useless use of '\'; doesn't escape metacharacter '{' at - line 6.
1364Useless use of '\'; doesn't escape metacharacter '{' at - line 8.
1365Useless use of '\'; doesn't escape metacharacter '[' at - line 10.
1366Useless use of '\'; doesn't escape metacharacter '(' at - line 11.
13671
13681
13691
13701
4d68ffa0
KW
13711
13721
13731
13741
1375q
13761
13771
13781
70502ce0
KW
13791
13801
4d68ffa0 1381q