www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2920] New: recursive templates blow compiler stack

reply d-bugmail puremagic.com writes:
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: bugzilla digitalmars.com
        ReportedBy: bugzilla 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;


-- 
May 02 2009
next sibling parent reply BCS <none anon.com> writes:
Hello d-bugmail puremagic.com,

 http://d.puremagic.com/issues/show_bug.cgi?id=2920
 
 Summary: recursive templates blow compiler stack
 ReportedBy: bugzilla digitalmars.com
I was about to mark this as Invalid with a comment that Walter has said that this is not going to be fixed (the error is correct, that stack /did/ get blown)... Then I noticed Walter Reported it. <g>
May 02 2009
parent Don <nospam nospam.com> writes:
BCS wrote:
 Hello d-bugmail puremagic.com,
 
 http://d.puremagic.com/issues/show_bug.cgi?id=2920

 Summary: recursive templates blow compiler stack
 ReportedBy: bugzilla digitalmars.com
I was about to mark this as Invalid with a comment that Walter has said that this is not going to be fixed (the error is correct, that stack /did/ get blown)... Then I noticed Walter Reported it. <g>
Not so, the bug is that there is no error message. For the first case, there's no error message, for the other cases, there's an error message on Windows, but not on Linux. BTW, (1) the text is mine -- I forwarded it to Walter as part of a list of crashes. (2) if it were not to be fixed, it should be WONTFIX rather than INVALID.
May 03 2009
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2920


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |clugdbug yahoo.com.au
         Resolution|                            |FIXED





Fixed DMD2.030 and 1.045.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 15 2009