digitalmars.D.bugs - [Issue 1438] New: Infinite recursive class template expansion
- d-bugmail puremagic.com (25/25) Aug 25 2007 http://d.puremagic.com/issues/show_bug.cgi?id=1438
- d-bugmail puremagic.com (34/34) Oct 21 2007 http://d.puremagic.com/issues/show_bug.cgi?id=1438
- d-bugmail puremagic.com (14/21) Oct 23 2007 http://d.puremagic.com/issues/show_bug.cgi?id=1438
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;
}
--
Aug 25 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1438
smjg iname.com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |smjg iname.com
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
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb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bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
bbbbbbbbbbbbbbbx") recursive expansion
i.e. it eventually realises that the template is infinitely recursive, which
strikes me as correct behaviour.
--
Oct 21 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1438
clugdbug yahoo.com.au changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |INVALID
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.
--
Oct 23 2007









d-bugmail puremagic.com 