www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 398] New: No way to abort compilation in a doubly recursive mixin

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=398

           Summary: No way to abort compilation in a doubly recursive mixin
           Product: D
           Version: 0.168
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: minor
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: clugdbug yahoo.com.au


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);
}


-- 
Oct 04 2006
next sibling parent Thomas Kuehne <thomas-dloop kuehne.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

d-bugmail 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-----
Oct 06 2006
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=398


clugdbug yahoo.com.au changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED





Fixed DMD1.032


-- 
Jul 09 2008
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=398






Fixed dmd 1.032 and 2.016


-- 
Jul 09 2008