Bug 7296 – [2.058] Regression: Cannot swap RefCounted

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2012-01-15T08:31:00Z
Last change time
2012-01-26T00:45:34Z
Assigned to
bugzilla
Creator
dsimcha
Depends on
7295

Comments

Comment #0 by dsimcha — 2012-01-15T08:31:42Z
This one is definitely caused by Bug 7295, but I'm reporting it as a separate issue because the effect on Phobos is a regression. The regression should be fixed for next release come Hell or high water, even if 7295 is not fixed and we have to resort to a workaround. import std.algorithm, std.typecons; void main() { RefCounted!int a, b; swap(a, b); } std\algorithm.d(1491): Error: pure function 'swap' cannot call impure function 'refCountedPayload'
Comment #1 by andrei — 2012-01-22T08:16:23Z
This is a compiler issue that I reduced to this: struct S { int member; @property ref int refCountedPayload() { return member; } alias refCountedPayload this; } void foo(S, T, Tdummy=void)(ref const S source, ref const T target) @trusted pure nothrow { } // for shared objects void foo(S, T)(ref const shared S source, ref const shared T target) @trusted pure nothrow { alias foo!(shared(S), shared(T), void) ptsTo; // do instantiate explicitly ptsTo(source, target); } void bar(T)(ref T lhs, ref T rhs) @trusted pure nothrow { foo(lhs, rhs); } void main() { S a, b; bar(a, b); }
Comment #2 by bugzilla — 2012-01-26T00:45:34Z