2920 – recursive templates blow compiler stack

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 2920 - recursive templates blow compiler stack
Summary: recursive templates blow compiler stack
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86 All
: P2 normal
Assignee: Walter Bright
URL:
Keywords: ice-on-invalid-code
Depends on:
Blocks:
Reported: 2009年05月02日 10:55 UTC by Walter Bright
Modified: 2015年06月09日 05:15 UTC (History)
2 users (show)

See Also:


Attachments
Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this issue.
Description Walter Bright 2009年05月02日 10:55:09 UTC
// 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;
Comment 1 Don 2009年05月15日 00:14:04 UTC
Fixed DMD2.030 and 1.045.


AltStyle によって変換されたページ (->オリジナル) /