Thread overview |
---|
August 25, 2007 [Issue 1438] New: Infinite recursive class template expansion | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=1438 Summary: Infinite recursive class template expansion Product: D Version: 1.020 Platform: PC OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: bugzilla@digitalmars.com ReportedBy: clugdbug@yahoo.com.au The code below creates an infinite set of class instances. Workaround: templatize every non-template function with a (Dummy=void) ------- class A(char [] text) { A!("a"~text) foo(T)() { return null; } // OK A!("b"~text) bar() { return null; } // recursive expansion } void main() { A!("x") b; } -- |
October 21, 2007 [Issue 1438] Infinite recursive class template expansion | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=1438 smjg@iname.com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |smjg@iname.com ------- Comment #1 from smjg@iname.com 2007-10-21 12:52 ------- What exactly is the bug that you're reporting? As I try it in DMD 1.022, I get bz1438.d(4): template instance bz1438.A!("bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb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bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb bbbbbbbbbbbbbbbx") recursive expansion i.e. it eventually realises that the template is infinitely recursive, which strikes me as correct behaviour. -- |
October 23, 2007 [Issue 1438] Infinite recursive class template expansion | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=1438 clugdbug@yahoo.com.au changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |INVALID ------- Comment #2 from clugdbug@yahoo.com.au 2007-10-23 10:34 ------- (In reply to comment #1) > What exactly is the bug that you're reporting? As I try it in DMD 1.022, I get > > bz1438.d(4): template instance > bz1438.A!("bbbbbbbbbbbbbbbbbbbbbb [snip]> bbbbbbbbbbbbbbbx") recursive expansion > > i.e. it eventually realises that the template is infinitely recursive, which strikes me as correct behaviour. You're right. It's simply ugly that the compiler think that it needs to instantiate every class recursively, when the classes are never used. It'd be nice to get rid of that (Dummy=void) hack, which has the nasty side-effect that it allows you to instantiate it as a template, for example as bar!(int). But it's not a bug. -- |
Copyright © 1999-2021 by the D Language Foundation