D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 16504 - [REG 2.072a]`dup` can't use storage class `scope` for its parameter in general
Summary: [REG 2.072a]`dup` can't use storage class `scope` for its parameter in general
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: druntime (show other issues)
Version: D2
Hardware: All All
: P1 regression
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-09-17 13:05 UTC by Denis Shelomovskii
Modified: 2017-01-16 23:24 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Denis Shelomovskii 2016-09-17 13:05:38 UTC
Currently `scope` is documented [1] as

> references in the parameter cannot be escaped

and `dup` is called for unrestricted set of types so type's postblit can assign references from the parameter to global variable thus violating `scope` storage class assumptions as there is no such restrictions for postblits.

This issues is cause by druntime pull #1637 [2].

[1] https://dlang.org/spec/function.html#parameters
[2] https://github.com/dlang/druntime/pull/1637
Comment 1 github-bugzilla 2016-10-29 11:39:34 UTC
Commits pushed to stable at https://github.com/dlang/druntime

https://github.com/dlang/druntime/commit/ce6aef38adbf7f652db67bc7287a97e45c173b8f
Revert "Merge pull request #1637 from WalterBright/scope-dup"

This reverts commit 35cd63567095bf865e0c7b4bb8bb92945b6244a5, reversing
changes made to aee373fb541dafce2769792b4430be82ef25bd2b.

- fixes Issue 16504 - dup can't use storage class scope for its parameter in general

https://github.com/dlang/druntime/commit/2f3f7c80d9843f4c2de05fdd2e15af71f185cf62
add unittest example for Issue 16504

- fairly synthetic example, but serves as documentation
Comment 2 github-bugzilla 2016-11-11 10:27:34 UTC
Commits pushed to master at https://github.com/dlang/druntime

https://github.com/dlang/druntime/commit/ce6aef38adbf7f652db67bc7287a97e45c173b8f
Revert "Merge pull request #1637 from WalterBright/scope-dup"

https://github.com/dlang/druntime/commit/2f3f7c80d9843f4c2de05fdd2e15af71f185cf62
add unittest example for Issue 16504
Comment 3 github-bugzilla 2016-12-27 13:10:51 UTC
Commits pushed to scope at https://github.com/dlang/druntime

https://github.com/dlang/druntime/commit/ce6aef38adbf7f652db67bc7287a97e45c173b8f
Revert "Merge pull request #1637 from WalterBright/scope-dup"

https://github.com/dlang/druntime/commit/2f3f7c80d9843f4c2de05fdd2e15af71f185cf62
add unittest example for Issue 16504
Comment 4 github-bugzilla 2017-01-16 23:24:00 UTC
Commits pushed to newCTFE at https://github.com/dlang/druntime

https://github.com/dlang/druntime/commit/ce6aef38adbf7f652db67bc7287a97e45c173b8f
Revert "Merge pull request #1637 from WalterBright/scope-dup"

https://github.com/dlang/druntime/commit/2f3f7c80d9843f4c2de05fdd2e15af71f185cf62
add unittest example for Issue 16504