summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorDave Mitchell <davem@fdisolutions.com>2004-01-20 22:27:50 +0000
committerDave Mitchell <davem@fdisolutions.com>2004-01-20 22:27:50 +0000
commit371fce9b46bb8a15ccc0f7dd533facec7830b379 (patch)
tree4523c643c79fa85c5a7aa59a8de84c8c941f3959 /ext
parentf935b2f67f1c88a353de5d1c0f7792d9812d8f31 (diff)
downloadperl-371fce9b46bb8a15ccc0f7dd533facec7830b379.tar.gz
[perl #24940] "sub foo :unique" segfaults
Turn these two into compile-time errors until such time as someone thinks of a useful meaning for them: my $x : unique sub foo : unique p4raw-id: //depot/perl@22187
Diffstat (limited to 'ext')
-rw-r--r--ext/threads/t/problems.t13
1 files changed, 12 insertions, 1 deletions
diff --git a/ext/threads/t/problems.t b/ext/threads/t/problems.t
index d555dcdc24..f4688134e5 100644
--- a/ext/threads/t/problems.t
+++ b/ext/threads/t/problems.t
@@ -18,7 +18,7 @@ use threads::shared;
# call is() from within the DESTROY() function at global destruction time,
# and parts of Test::* may have already been freed by then
-print "1..8\n";
+print "1..10\n";
my $test : shared = 1;
@@ -93,6 +93,17 @@ threads->new(
}
)->join;
+# bugid #24940 :unique should fail on my and sub declarations
+
+for my $decl ('my $x : unique', 'sub foo : unique') {
+ eval $decl;
+ print $@ =~
+ /^The 'unique' attribute may only be applied to 'our' variables/
+ ? '' : 'not ', "ok $test - $decl\n";
+ $test++;
+}
+
+
# Returing a closure from a thread caused problems. If the last index in
# the anon sub's pad wasn't for a lexical, then a core dump could occur.
# Otherwise, there might be leaked scalars.