summaryrefslogtreecommitdiff
path: root/t/class/field.t
diff options
context:
space:
mode:
authorPaul "LeoNerd" Evans <leonerd@leonerd.org.uk>2023-03-04 17:13:54 +0000
committerPaul Evans <leonerd@leonerd.org.uk>2023-03-07 11:32:21 +0000
commit2da014bc9fd80ae0453878c6cca2e22309637641 (patch)
treeba06ef24f0f67e23673c00e034854c3fda3922ee /t/class/field.t
parent3740cf6d26acbeaa48675e7ec51b6c92f5749e8b (diff)
downloadperl-2da014bc9fd80ae0453878c6cca2e22309637641.tar.gz
Permit internal OP_GOTO when forbidding out-of-block ops
Diffstat (limited to 't/class/field.t')
-rw-r--r--t/class/field.t15
1 files changed, 15 insertions, 0 deletions
diff --git a/t/class/field.t b/t/class/field.t
index ba4e64baca..a12fb65413 100644
--- a/t/class/field.t
+++ b/t/class/field.t
@@ -282,4 +282,19 @@ no warnings 'experimental::class';
'Values for missing');
}
+# field initialiser expressions permit `goto` in do {} blocks
+{
+ class Test13 {
+ field $forwards = do { goto HERE; HERE: 1 };
+ field $backwards = do { my $x; HERE: ; goto HERE if !$x++; 2 };
+
+ method values { return ($forwards, $backwards) }
+ }
+
+ ok(eq_array(
+ [Test13->new->values],
+ [1, 2],
+ 'Values for goto inside do {} blocks in field initialisers'));
+}
+
done_testing;