[Issue 398] New: No way to abort compilation in a doubly recursive mixin

Thomas Kuehne thomas-dloop at kuehne.cn
Fri Oct 6 00:05:31 PDT 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

d-bugmail at puremagic.com schrieb am 2006-10-04:
> http://d.puremagic.com/issues/show_bug.cgi?id=398

> This program generates 2^16 local variables called 'val'. Oops. But the problem
> is, the compiler hangs. It would be better if ^C worked, or even if it just
> segfaulted! But probably, there just needs to be some check on number of local
> variables.
>
> (BTW, it's *really* cool that this code actually works for smaller numbers of
> w, eg rubbish!(10).)
>
> ---------
> template rubbish(int w)
> {
>     static if (w<=0) {
>         int val = 2;
>     } else {
>         mixin rubbish!(w-1) left;
>         mixin rubbish!(w-1) right;
>     }
> }
>
> void main()
> {
>     mixin rubbish!(15);
> }

Added to DStress as
http://dstress.kuehne.cn/run/m/mixin_25_A.d
http://dstress.kuehne.cn/nocompile/m/mixin_25_B.d

Thomas


-----BEGIN PGP SIGNATURE-----

iD8DBQFFJgXvLK5blCcjpWoRAotVAJ9X0CWuInG+4dJDIkD/9OIb7Td9KQCfeXlp
kSi+etI2JTZkT2e1amaKjVQ=
=VrRy
-----END PGP SIGNATURE-----



More information about the Digitalmars-d-bugs mailing list