The logic was written in such a way that goto "" just happened to slip
past all the checks and cause pp_goto to return NULL for the next op,
which means the end of the program.
goto ${\""} dies with ‘goto must have label’, so goto ""
should as well.
This also adds other tests for that error, which was apparently
untested till now.
label = cPVOP->op_pv;
label_flags = (cPVOP->op_private & OPpPV_IS_UTF8) ? SVf_UTF8 : 0;
label_len = strlen(label);
+ if (!(do_dump || *label)) DIE(aTHX_ must_have_label);
}
PERL_ASYNC_CHECK();
use warnings;
use strict;
-plan tests => 80;
+plan tests => 83;
our $TODO;
my $deprecated = 0;
same_prefix_labels(),
"perl 112316: goto and labels with the same prefix doesn't get mixed up"
);
+
+eval { my $x = ""; goto $x };
+like $@, qr/^goto must have label at /, 'goto $x where $x is empty string';
+eval { goto "" };
+like $@, qr/^goto must have label at /, 'goto ""';
+eval { goto };
+like $@, qr/^goto must have label at /, 'argless goto';