Code:
-------
/* test.d */
import std.uni;
-------
Compile command:
-------
dmd -dip1000 -unittest -c test.d
-------
Compiler output:
-------
/usr/src/d/phobos/std/uni.d(2554): Error: reference to local variable __tmpfordtor853 assigned to non-scope parameter this calling std.uni.InversionList!(GcPolicy).InversionList.byInterval
/usr/src/d/phobos/std/uni.d(1976): Error: template instance std.uni.InversionList!(GcPolicy) error instantiating
-------
This used to work fine until recently. Will post an update once I finish git bisecting.
Comment #1 by hsteoh — 2017-11-02T20:30:19Z
P.S. This bug is causing my otherwise-dip1000-compliant code to no longer compile, making it impossible to build the code with dip1000 (unless I disable -unittest, but that's not a practical workaround during development).
Comment #2 by hsteoh — 2017-11-02T20:34:23Z
Found the offending commit: 905788a65a4b7833f52ee0701dc919ee54f0d35b (Phobos PR #5337).
Comment #3 by hsteoh — 2017-11-02T20:36:04Z
P.S., this bug pertains to Phobos git HEAD, not to any release (that I'm aware of).
Comment #4 by dmitry.olsh — 2017-11-03T06:59:29Z
(In reply to hsteoh from comment #0)
> Code:
> -------
> /* test.d */
> import std.uni;
> -------
>
> Compile command:
> -------
> dmd -dip1000 -unittest -c test.d
> -------
>
> Compiler output:
> -------
> /usr/src/d/phobos/std/uni.d(2554): Error: reference to local variable
> __tmpfordtor853 assigned to non-scope parameter this calling
> std.uni.InversionList!(GcPolicy).InversionList.byInterval
> /usr/src/d/phobos/std/uni.d(1976): Error: template instance
> std.uni.InversionList!(GcPolicy) error instantiating
> -------
>
> This used to work fine until recently. Will post an update once I finish git
> bisecting.
Most curious. But AFAIK Phobos is not compiled with -dip1000 yet.
Comment #5 by hsteoh — 2017-11-03T22:07:03Z
Yeah, I know Phobos is not -dip1000 ready yet. That's probably how this PR got pulled in spite of the breakage. :-P
It would be nice to fix these breakages, though. Less trouble for when we do want to start building Phobos with -dip1000.
Comment #6 by issues.dlang — 2017-11-03T22:37:23Z
(In reply to hsteoh from comment #5)
> Yeah, I know Phobos is not -dip1000 ready yet. That's probably how this PR
> got pulled in spite of the breakage. :-P
>
> It would be nice to fix these breakages, though. Less trouble for when we
> do want to start building Phobos with -dip1000.
I think that Walter has done a few PRs to fix DIP 1000 issues in Phobos, but as long as -dip1000 isn't being used, we're going to continue to introduce code that doesn't work with it and have to create new PRs to fix that breakage when we catch it. I don't think that -dip1000 is really ready to be enabled though, even if all of druntime and Phobos worked with it. So, we could be at this for a while, depending on how long it takes for -dip1000 to be ready.
Comment #7 by chilli — 2018-01-10T09:40:52Z
Although -dip1000 is not ready, it's complaint seems to be justified in at least 1 of 2 spots here:
The complaints originate in the function immediately preceding the reported error line: ref intersect()(dchar ch)
(1) There are 2 assignments to this: this = This.init...
that raise the error, IMO legitimately: reference to local variable __tmp... assigned to non-scope parameter this.
This could be calmed down using instead: data.length(0); I hope it's an equivalent for This.init in this case.
(2) The other one (same error msg) stems from this.byInterval in the foreach loop and seems to be questionable.
In the end, this works with -dip1000 enabled:
ref intersect()(dchar ch)
{
scope arr = data;
foreach (i; Intervals!(typeof(data))(arr))
if (i.a <= ch && ch < i.b)
{
data.length(0);
return this.add(ch, ch+1);
}
data.length(0);
return this;
}
If there are no objections, I'll file a PR Fix issue 17961 - ...
Comment #8 by code — 2018-01-17T10:37:53Z
(In reply to Carsten Blüggel from comment #7)
> If there are no objections, I'll file a PR Fix issue 17961 - ...
Yes, those issues prevent trying out dip1000, and it's worthwhile to fix them, even though support for all of phobos is out of reach for now.
And btw, you shouldn't ask for permission to fix an issue ;).