View mode: basic / threaded / horizontal-split · Log in · Help
October 04, 2006
[Issue 398] New: No way to abort compilation in a doubly recursive mixin
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);
}


--
October 06, 2006
Re: [Issue 398] New: No way to abort compilation in a doubly recursive mixin
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
July 09, 2008
[Issue 398] No way to abort compilation in a doubly recursive mixin
http://d.puremagic.com/issues/show_bug.cgi?id=398


clugdbug@yahoo.com.au changed:

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




------- Comment #2 from clugdbug@yahoo.com.au  2008-07-09 07:18 -------
Fixed DMD1.032


--
July 10, 2008
[Issue 398] No way to abort compilation in a doubly recursive mixin
http://d.puremagic.com/issues/show_bug.cgi?id=398





------- Comment #3 from bugzilla@digitalmars.com  2008-07-09 22:32 -------
Fixed dmd 1.032 and 2.016


--
Top | Discussion index | About this forum | D home