www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - Compiler hangs on recursive template

reply Nick <Nick_member pathlink.com> writes:
DMD hangs when trying to compile the following:

template AA(int i) {
class A : AA!(i+1).A {}
}
alias AA!(0).A A0;

If you add something that stops the recursion somehow, for example

template AA(int i : 20)
{class A {}}

then it works as expected. I'm using 0.126 on linux.

Nick
Jun 10 2005
next sibling parent "Walter" <newshound digitalmars.com> writes:
Weeelll, it eventually will fail with a stack fault. It just takes a long
time.
Jun 10 2005
prev sibling parent Thomas Kuehne <thomas-dloop kuehne.this-is-spam.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Nick schrieb am Fri, 10 Jun 2005 11:30:02 +0000 (UTC):
 DMD hangs when trying to compile the following:

 template AA(int i) {
 class A : AA!(i+1).A {}
 }
 alias AA!(0).A A0;

 If you add something that stops the recursion somehow, for example

 template AA(int i : 20)
 {class A {}}

 then it works as expected. I'm using 0.126 on linux.
Added to DStress as http://dstress.kuehne.cn/nocompile/t/template_16.d http://dstress.kuehne.cn/nocompile/t/template_class_09.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFCqoNn3w+/yD4P9tIRAhr+AJ9rLyXxhMjgESLACEeEtY/C6jwoJwCfclV+ xZ65YRJ03oKc2IhClPz4wOA= =95Q3 -----END PGP SIGNATURE-----
Jun 10 2005