Thread overview
[Issue 475] New: DMD segfault on recursive variadic template
Nov 02, 2006
d-bugmail
Nov 23, 2006
Thomas Kuehne
Nov 25, 2006
d-bugmail
November 02, 2006
http://d.puremagic.com/issues/show_bug.cgi?id=475

           Summary: DMD segfault on recursive variadic template
           Product: D
           Version: 0.173
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: korslund@gmail.com


The following code crashes DMD on linux:

template recMove(int i, X...)
{
  void recMove()
    {
      X[i] = X[i+1];
      // I know the code is logically wrong, should test (i+2 < X.length)
      static if(i+1 < X.length) recMove!(i+1, X);
    }
}

void main()
{
  int a, b;
  recMove!(0, a, b);
}


-- 

November 23, 2006
d-bugmail@puremagic.com schrieb am 2006-11-02:
> http://d.puremagic.com/issues/show_bug.cgi?id=475

> The following code crashes DMD on linux:
>
> template recMove(int i, X...)
> {
>   void recMove()
>     {
>       X[i] = X[i+1];
>       // I know the code is logically wrong, should test (i+2 < X.length)
>       static if(i+1 < X.length) recMove!(i+1, X);
>     }
> }
>
> void main()
> {
>   int a, b;
>   recMove!(0, a, b);
> }

Added to DStress as http://dstress.kuehne.cn/nocompile/t/tuple_01_A.d

Thomas


November 25, 2006
http://d.puremagic.com/issues/show_bug.cgi?id=475


bugzilla@digitalmars.com changed:

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




------- Comment #2 from bugzilla@digitalmars.com  2006-11-25 03:56 -------
Fixed DMD 0.175


--