Thread overview
[Issue 710] New: compiler assertion failure w/ templates
Dec 22, 2006
d-bugmail
Dec 26, 2006
Thomas Kuehne
Jan 01, 2007
d-bugmail
December 22, 2006
http://d.puremagic.com/issues/show_bug.cgi?id=710

           Summary: compiler assertion failure w/ templates
           Product: D
           Version: 0.177
          Platform: PC
               URL: http://www.digitalmars.com/pnews/read.php?server=news.di
                    gitalmars.com&group=digitalmars.D.bugs&artnum=9574
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: ddaglas@gmail.com


The following code:

static int _i=0;

template NEXT(int idx) {
  const NEXT = idx;
}

interface Protocol {
  static ubyte HELO = NEXT!(_i++);
}

void main() { }

causes the Win32 dmd compiler to error with the following:

C:\>dmd z.d
global.errors = 0, gag = 0
00936D54 ++ type=int e1=00962524 e2=00936D78
  00962524 var var=_i type=int
  00936D78 1 type=int
Assertion failure: '0' on line 775 in file 'expression.c'

abnormal program termination

--- errorlevel 1


-- 

December 26, 2006
d-bugmail@puremagic.com schrieb am 2006-12-22:
> http://d.puremagic.com/issues/show_bug.cgi?id=710

> The following code:
>
> static int _i=0;
>
> template NEXT(int idx) {
>   const NEXT = idx;
> }
>
> interface Protocol {
>   static ubyte HELO = NEXT!(_i++);
> }
>
> void main() { }
>
> causes the Win32 dmd compiler to error with the following:
>
> C:\>dmd z.d
> global.errors = 0, gag = 0
> 00936D54 ++ type=int e1=00962524 e2=00936D78
>   00962524 var var=_i type=int
>   00936D78 1 type=int
> Assertion failure: '0' on line 775 in file 'expression.c'
>
> abnormal program termination

old test cases triggering this bug: http://dstress.kuehne.cn/nocompile/t/template_30_A.d http://dstress.kuehne.cn/nocompile/t/template_30_B.d http://dstress.kuehne.cn/nocompile/t/template_30_C.d http://dstress.kuehne.cn/nocompile/t/template_30_D.d http://dstress.kuehne.cn/nocompile/t/template_30_E.d

Added to DStress as http://dstress.kuehne.cn/nocompile/t/template_52_A.d http://dstress.kuehne.cn/nocompile/t/template_52_B.d http://dstress.kuehne.cn/nocompile/t/template_52_C.d

Thomas


January 01, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=710


thomas-dloop@kuehne.cn changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         OS/Version|Windows                     |All
         Resolution|                            |FIXED




------- Comment #2 from thomas-dloop@kuehne.cn  2007-01-01 15:21 -------
fixed in DMD-0.178


--