Bug 475 – DMD segfault on recursive variadic template
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Linux
Creation time
2006-11-02T12:55:00Z
Last change time
2014-02-15T13:21:04Z
Assigned to
bugzilla
Creator
korslund
Comments
Comment #0 by korslund — 2006-11-02T12:55:24Z
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);
}
Comment #1 by thomas-dloop — 2006-11-23T04:56:42Z
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
[email protected] 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-----