www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 475] New: DMD segfault on recursive variadic template

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


-- 
Nov 02 2006
next sibling parent Thomas Kuehne <thomas-dloop kuehne.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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 -----BEGIN PGP SIGNATURE----- iD8DBQFFZYJOLK5blCcjpWoRAolDAJ9QbilfZjWl13MDgUwXw0GlxH62vgCfTMK2 IvfT8FNbSFcw65rGnkKlOyk= =tbQ7 -----END PGP SIGNATURE-----
Nov 23 2006
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=475


bugzilla digitalmars.com changed:

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





Fixed DMD 0.175


-- 
Nov 25 2006