diff --git a/dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Node.pm b/dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Node.pm index 8fa07a41aed4..245e6c01279e 100644 --- a/dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Node.pm +++ b/dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Node.pm @@ -3648,7 +3648,7 @@ sub parse { $self->SUPER::parse($pxs); # set file/line_no, read lines my @lines = @{$self->{lines}}; - shift @lines while $lines[0] !~ /\S/; + shift @lines while @lines && $lines[0] !~ /\S/; # XXX ParseXS originally didn't include a trailing \n, # so we carry on doing the same. $self->{text} = join "\n", @lines; diff --git a/dist/ExtUtils-ParseXS/t/001-basic.t b/dist/ExtUtils-ParseXS/t/001-basic.t index 9e7c3acaee29..5101a9d45959 100644 --- a/dist/ExtUtils-ParseXS/t/001-basic.t +++ b/dist/ExtUtils-ParseXS/t/001-basic.t @@ -1656,6 +1656,16 @@ EOF [ 0, 0, qr/\Qfoo(a, b , bar, c? c : "boo!")/, "" ], ], + [ + "autocall args empty C_ARGS", + [ Q(<<'EOF') ], + |void + |foo(int a) + | C_ARGS: +EOF + [ 0, 0, qr/\Qfoo()/, "" ], + ], + [ # Whether this is sensible or not is another matter. # For now, just check that it works as-is.