Is instantiabilty of templated types decidable?
Manfred Nowak
svv1999 at hotmail.com
Sun Nov 11 04:33:25 PST 2012
This code implements sort of an unary counter:
class Elem( size_t mynumber) {
Elem!( mynumber +1)* next;
}
void main(){
auto unaryCounter= new Elem!0;
}
Although only `Elem!0' has to be instantiated dmd 2.060 on
windows shouts:
Error: template instance Elem!(500u) recursive expansion
This is the reason for the subject. Because:
a) Instantiability is decidable
Why does the compiler stop with the evaluation at that randomly
choosen and apparently hard coded value of 500 recursive
expansions?
b) Instantiability is not decidable
Why does the compiler even try to instantiate more than the
indeed needed type `Elem!0'?
I miss the rationale for this behaviour.
-manfred
More information about the Digitalmars-d
mailing list