www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - compiler assertion failure w/ templates

reply Dan <ddaglas gmail.com> writes:
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

--Dan

P.S. Is Bugzilla still down?  If not, how do I post bugs formally and/or
review if they're already reported?
Dec 17 2006
parent Bill Baxter <dnewsgroup billbaxter.com> writes:
Bugzilla is back.  URL is:
http://d.puremagic.com/issues/
I think how to use it is pretty self-explanatory.

--bb

Dan wrote:
 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
 
 --Dan
 
 P.S. Is Bugzilla still down?  If not, how do I post bugs formally and/or
 review if they're already reported?
Dec 17 2006