From 12a2bf96bd6457599f542a58dc94914bc0659ad0 Mon Sep 17 00:00:00 2001 From: Samuel Young Date: Mon, 4 Aug 2025 08:41:03 -0500 Subject: [PATCH] todo test for GH 18669 (dereferencing ternary skips autovivification) --- t/run/todo.t | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/t/run/todo.t b/t/run/todo.t index 7c55292b5ff1..c654660c8e68 100644 --- a/t/run/todo.t +++ b/t/run/todo.t @@ -101,6 +101,27 @@ TODO: { is($?, 0, "No assertion failure"); } +TODO: { + local $::TODO = 'GH 18669'; + + my $results = fresh_perl(<<~'EOF', {}); + my $x = { arr => undef }; + push(@{ $x->{ decide } ? $x->{ not_here } : $x->{ new } }, "mana"); + print $x->{ new }[0]; + EOF + is($?, 0, "No assertion failure"); + is($results, 'mana', 'push on non-existent hash entry from ternary autovivifies array ref'); + + $results = fresh_perl(<<~'EOF', {}); + my $x = { arr => undef }; + push(@{ $x->{ decide } ? $x->{ not_here } : $x->{ arr } }, "mana"); + print $x->{ arr }[0]; + EOF + is($?, 0, "No assertion failure"); + is($results, 'mana', 'push on undef hash entry from ternary autovivifies array ref'); + +} + { fresh_perl('use re "eval"; my @r;