summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorAaron Crane <arc@cpan.org>2016-01-03 14:29:43 +0000
committerAaron Crane <arc@cpan.org>2016-01-03 15:29:24 +0000
commita934a4a7d4fa99d522e169b921286755a0f8d248 (patch)
tree4f4d94470873c2185769df3dfac7c3fb9e58ad91 /t
parent83677dc5596295a5b5095063d96f95de3735933a (diff)
downloadperl-a934a4a7d4fa99d522e169b921286755a0f8d248.tar.gz
Remove unwarranted assertion in Perl_newATTRSUB_x()
RT #126845: if a stub subroutine definition with a prototype has been seen, then any subsequent stub (or definition) of the same subroutine with an attribute was causing an assertion failure because of a null pointer. This assertion was added in 2eaf799e74b14dc77b90d5484a3fd4ceac12b46a, which itself would already have triggered this assertion failure, even though all subsequent uses of the pointer in question were guarded with non-null conditions. So merely deleting the assertion is the right thing.
Diffstat (limited to 't')
-rw-r--r--t/op/sub.t9
1 files changed, 8 insertions, 1 deletions
diff --git a/t/op/sub.t b/t/op/sub.t
index d9b7b3c97e..0e9b60334f 100644
--- a/t/op/sub.t
+++ b/t/op/sub.t
@@ -6,7 +6,7 @@ BEGIN {
set_up_inc('../lib');
}
-plan(tests => 55);
+plan(tests => 57);
sub empty_sub {}
@@ -246,6 +246,13 @@ predeclared(); # set $x to 42
$main::x = $main::x = "You should not see this.";
inside_predeclared(); # run test
+# RT #126845: this used to fail an assertion in Perl_newATTRSUB_x()
+eval 'sub rt126845_1 (); sub rt126845_1 () :lvalue';
+pass("RT #126845: stub with prototype, then with attribute");
+
+eval 'sub rt126845_2 (); sub rt126845_2 () :lvalue {}';
+pass("RT #126845: stub with prototype, then definition with attribute");
+
# RT #124156 death during unwinding causes crash
# the tie allows us to trigger another die while cleaning up the stack
# from an earlier die.