Issue 16582 - [REG2.072.0-b1] ParamterDefaultValueTuple fails to compile for scope paramters
Summary: [REG2.072.0-b1] ParamterDefaultValueTuple fails to compile for scope paramters
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: All All
: P1 regression
Assignee: No Owner
URL:
Keywords: pull
Depends on:
Blocks:
 
Reported: 2016-10-03 17:11 UTC by Sönke Ludwig
Modified: 2017-01-16 23:24 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Sönke Ludwig 2016-10-03 17:11:30 UTC
---
import std.traits;
class C {}
void foo(scope C bar = null) {}
static assert(ParameterDefaultValueTuple!foo[0] == null);
---

For DMD 2.072.0-b1, results in:

.../src/phobos/std/traits.d-mixin-1211(1211): Error: scope variable bar may not be returned

Works correctly up to 2.071.2
Comment 1 Martin Nowak 2016-10-15 16:27:50 UTC
Introduced by https://github.com/dlang/dmd/pull/5903.
Comment 2 Walter Bright 2016-10-15 21:44:57 UTC
And apparently fixed by https://github.com/dlang/dmd/pull/5972
Comment 3 Sönke Ludwig 2016-10-16 09:26:16 UTC
But still a regression in 2.072.0, even if #5972 gets merged for 2.073.0.
Comment 4 Martin Nowak 2016-10-16 12:23:47 UTC
Somewhat hacky workaround for ParameterDefaults.
https://github.com/dlang/phobos/pull/4864

If more problems w/ the scope checks pop up, we might have to back-off that error.
Comment 5 github-bugzilla 2016-10-17 18:51:07 UTC
Commits pushed to stable at https://github.com/dlang/phobos

https://github.com/dlang/phobos/commit/f783d975a28febea3a323bae3ce5f902cec17aa9
fix Issue 16582 - ParameterDefaults fails w/ scope parameter

- workaround scope escape error to get default parameter
- would require a working `return scope` for a proper implementation

https://github.com/dlang/phobos/commit/e333b7ad4e69b603bc9dfc1cb74593baf43b2193
Merge pull request #4864 from MartinNowak/fix16582

fix Issue 16582 - ParameterDefaults fails w/ scope parameter
Comment 6 github-bugzilla 2016-11-20 23:19:13 UTC
Commits pushed to master at https://github.com/dlang/phobos

https://github.com/dlang/phobos/commit/f783d975a28febea3a323bae3ce5f902cec17aa9
fix Issue 16582 - ParameterDefaults fails w/ scope parameter

https://github.com/dlang/phobos/commit/e333b7ad4e69b603bc9dfc1cb74593baf43b2193
Merge pull request #4864 from MartinNowak/fix16582
Comment 7 github-bugzilla 2016-12-27 13:11:04 UTC
Commits pushed to scope at https://github.com/dlang/phobos

https://github.com/dlang/phobos/commit/f783d975a28febea3a323bae3ce5f902cec17aa9
fix Issue 16582 - ParameterDefaults fails w/ scope parameter

https://github.com/dlang/phobos/commit/e333b7ad4e69b603bc9dfc1cb74593baf43b2193
Merge pull request #4864 from MartinNowak/fix16582
Comment 8 github-bugzilla 2017-01-16 23:24:14 UTC
Commits pushed to newCTFE at https://github.com/dlang/phobos

https://github.com/dlang/phobos/commit/f783d975a28febea3a323bae3ce5f902cec17aa9
fix Issue 16582 - ParameterDefaults fails w/ scope parameter

https://github.com/dlang/phobos/commit/e333b7ad4e69b603bc9dfc1cb74593baf43b2193
Merge pull request #4864 from MartinNowak/fix16582