[Issue 398] New: No way to abort compilation in a doubly recursive mixin
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Oct 4 02:46:55 PDT 2006
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 at digitalmars.com
ReportedBy: clugdbug at 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);
}
--
More information about the Digitalmars-d-bugs
mailing list