www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 7296] New: [2.058] Regression: Cannot swap RefCounted

reply d-bugmail puremagic.com writes:
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



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: -------
Jan 15 2012
next sibling parent d-bugmail puremagic.com writes:
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: -------
Jan 18 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
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



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: -------
Jan 22 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7296


Walter Bright <bugzilla digitalmars.com> changed:

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



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: -------
Jan 26 2012