Bug 142 – Assertion failure: '0' on line 610 in file 'template.c'

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Windows
Creation time
2006-05-17T15:41:00Z
Last change time
2014-02-15T13:22:18Z
Keywords
ice-on-invalid-code
Assigned to
bugzilla
Creator
lio+bugzilla

Comments

Comment #0 by lio+bugzilla — 2006-05-17T15:41:58Z
// I don't know if the code is supposed to work, // but I'm trying to convert // #define A(x) x=2 template A(alias T) { void A(T) { T=2; } } void main() { int i; A(i); assert(i==2); }
Comment #1 by fvbommel — 2006-05-17T16:38:40Z
That definitely looks like a compiler bug. That said, I'm pretty sure that code shouldn't compile anyway. I think what you're trying to do is probably something like this: // translation of "#define A(x) x=2". // Note it can't be translated exactly because the macro doesn't // have parentheses around it, so code like "A(x) + 2" _will_ do // something different. // (i.e. this is actually the translation of "#define A(x) (x=2)") template A(T) { void A(out T x) { x=2; } } void main() { int i; A(i); assert(i==2); }
Comment #2 by smjg — 2006-05-18T07:54:43Z
(In reply to comment #1) > That definitely looks like a compiler bug. An assertion failure is a bug by definition. > That said, I'm pretty sure that code shouldn't compile anyway. It took me a moment to work it out. But indeed, it shouldn't compile, because the parameter T has no type.
Comment #3 by thomas-dloop — 2006-05-19T11:46:11Z
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 [email protected] schrieb am 2006-05-17: > // I don't know if the code is supposed to work, > // but I'm trying to convert > // #define A(x) x=2 > template A(alias T) { > void A(T) { T=2; } > } > > void main() > { > int i; > A(i); > assert(i==2); > } Added to DStress as http://dstress.kuehne.cn/nocompile/b/bug_template_610_A.d http://dstress.kuehne.cn/nocompile/b/bug_template_610_B.d http://dstress.kuehne.cn/run/b/bug_template_610_C.d http://dstress.kuehne.cn/nocompile/b/bug_template_610_D.d http://dstress.kuehne.cn/nocompile/b/bug_template_610_E.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFEbcGt3w+/yD4P9tIRAltgAJ9eDNdj4UwVVLBBOS71y+P08DovOgCglJQ1 /bx90fnYGDBlXN+TlpuA+3s= =/kd+ -----END PGP SIGNATURE-----
Comment #4 by bugzilla — 2006-05-25T04:24:17Z
Fixed 0.158