From: Rafael Garcia-Suarez Date: Wed, 18 Oct 2006 14:01:59 +0000 (+0000) Subject: The _ character is only allowed to be at the end of prototypes X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f00d1d61e031a2a79e331ee3ee031a4f658d26e8;p=p5sagit%2Fp5-mst-13.2.git The _ character is only allowed to be at the end of prototypes p4raw-id: //depot/perl@29036 --- diff --git a/op.c b/op.c index eb14e03..95fb100 100644 --- a/op.c +++ b/op.c @@ -7376,6 +7376,9 @@ Perl_ck_subr(pTHX_ OP *o) proto++; continue; case '_': + /* _ must be at the end */ + if (proto[1]) + goto oops; case '$': proto++; arg++; diff --git a/t/comp/uproto.t b/t/comp/uproto.t index 16c748a..d09461f 100644 --- a/t/comp/uproto.t +++ b/t/comp/uproto.t @@ -6,7 +6,7 @@ BEGIN { require "./test.pl"; } -plan(tests => 28); +plan(tests => 30); sub f($$_) { my $x = shift; is("@_", $x) } @@ -57,3 +57,9 @@ $_ = $expected; g(); undef $expected; &g; # $_ not passed { $expected = my $_ = "bar"; g() } + +eval q{ sub wrong1 (_$); wrong1(1,2) }; +like( $@, qr/Malformed prototype for main::wrong1/, 'wrong1' ); + +eval q{ sub wrong2 ($__); wrong2(1,2) }; +like( $@, qr/Malformed prototype for main::wrong2/, 'wrong2' );