Thread overview
[Issue 8506] New: segault when using map with template delegate
Aug 04, 2012
deadalnix
Aug 04, 2012
Kenji Hara
Aug 04, 2012
deadalnix
Aug 06, 2012
deadalnix
Oct 26, 2012
Maxim Fomin
August 04, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8506

           Summary: segault when using map with template delegate
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: druntime
        AssignedTo: nobody@puremagic.com
        ReportedBy: deadalnix@gmail.com


--- Comment #0 from deadalnix <deadalnix@gmail.com> 2012-08-04 04:54:03 PDT ---
import std.algorithm;
import std.array;

class A {
    B[] b;
}

class B {}

void main() {
    A a;

    a.b = a.b.map!(b => b)().array();
}

This code segfault in invariant._d_invariant with dmd 2.060 . This ork fine with (B b) { return b; } as delegate.

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



--- Comment #1 from Kenji Hara <k.hara.pg@gmail.com> 2012-08-04 10:22:27 PDT ---
(In reply to comment #0)
> import std.algorithm;
> import std.array;
> 
> class A {
>     B[] b;
> }
> 
> class B {}
> 
> void main() {
>     A a;
> 
>     a.b = a.b.map!(b => b)().array();
> }
> 
> This code segfault in invariant._d_invariant with dmd 2.060 . This ork fine with (B b) { return b; } as delegate.

The variable a is class, and initialized with null, then this code never works.

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



--- Comment #2 from deadalnix <deadalnix@gmail.com> 2012-08-04 10:57:04 PDT ---
(In reply to comment #1)
> (In reply to comment #0)
> > import std.algorithm;
> > import std.array;
> > 
> > class A {
> >     B[] b;
> > }
> > 
> > class B {}
> > 
> > void main() {
> >     A a;
> > 
> >     a.b = a.b.map!(b => b)().array();
> > }
> > 
> > This code segfault in invariant._d_invariant with dmd 2.060 . This ork fine with (B b) { return b; } as delegate.
> 
> The variable a is class, and initialized with null, then this code never works.

Ooops, it seems I failed to reduce the bug to a simple case (I actually introduced a new problem of my own, you are right). And if I initialize a, the segfault don't occur. This bug report is invalid, I'll create a new one with some help of dustmite.

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



--- Comment #3 from deadalnix <deadalnix@gmail.com> 2012-08-06 13:40:32 PDT ---
http://d.puremagic.com/issues/show_bug.cgi?id=8514

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


Maxim Fomin <maxim@maxim-fomin.ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |maxim@maxim-fomin.ru
         Resolution|                            |DUPLICATE


--- Comment #4 from Maxim Fomin <maxim@maxim-fomin.ru> 2012-10-26 11:45:18 PDT ---
*** This issue has been marked as a duplicate of issue 8514 ***

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