Summary: recursive templates blow compiler stack
           Product: D
           Version: unspecified
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD

// 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 foo(size_t i){
            static if(i > 0){
                const size_t bar = foo!(i-1).bar;
                const size_t bar = 1;

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

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

        alias Template!(0).Class Class0;


Reply via email to