Thread overview
[Issue 7296] New: [2.058] Regression: Cannot swap RefCounted
Jan 15, 2012
David Simcha
Jan 19, 2012
Brad Roberts
Jan 26, 2012
Walter Bright
January 15, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7296

           Summary: [2.058] Regression:  Cannot swap RefCounted
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: regression
          Priority: P2
         Component: Phobos
        AssignedTo: nobody@puremagic.com
        ReportedBy: dsimcha@yahoo.com
        Depends on: 7295


--- Comment #0 from David Simcha <dsimcha@yahoo.com> 2012-01-15 08:31:42 PST ---
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'

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 19, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7296


Brad Roberts <braddr@puremagic.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |braddr@puremagic.com
         AssignedTo|nobody@puremagic.com        |andrei@metalanguage.com
   Target Milestone|---                         |2.058


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 22, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7296


Brad Roberts <braddr@puremagic.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|2.058                       |---

Andrei Alexandrescu <andrei@metalanguage.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
         AssignedTo|andrei@metalanguage.com     |bugzilla@digitalmars.com


--- Comment #1 from Andrei Alexandrescu <andrei@metalanguage.com> 2012-01-22 08:16:23 PST ---
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);
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 26, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7296


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


--- Comment #2 from Walter Bright <bugzilla@digitalmars.com> 2012-01-26 00:45:34 PST ---
https://github.com/D-Programming-Language/dmd/commit/2357f7771b7a5bdd560c2e8e9656d4194e8388d9

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------