http://d.puremagic.com/issues/show_bug.cgi?id=2920

           Summary: recursive templates blow compiler stack
           Product: D
           Version: unspecified
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzi...@digitalmars.com
        ReportedBy: bugzi...@digitalmars.com


// dstress template_16 infinite loop. This should generate
// a "recursive template expansion" error, but it doesn't.
template Template(int i) {
            mixin Template!(i+1);
}       
mixin Template!(0);

// ==============================================
// Bugs I cannot reproduce on Windows, but which fail on dstress suite
// DMD 1.043 Linux. They are all have the same root cause.
//  All generate "recursive template expansion" error on Windows
// template_17_A.
  template t(int i){
            const int x = t!(i+1).x;
        }

        void main(){
            int i = t!(0).x;
        }
 //template_29_B.
 template foo(size_t i){
            static if(i > 0){
                const size_t bar = foo!(i-1).bar;
            }else{
                const size_t bar = 1;
            }
        }

        int main(){
            return foo!(size_t.max).bar;
        }

  //template_class_09.
        template Template(int i) {
            class Class : Template!(i+1).Class{
            }
        }

        alias Template!(0).Class Class0;


-- 

Reply via email to