changeset 1514:891196dcfc3a

[Issue 1068] stack corruption with mixins and function templates Tomasz Stachowiak <h3r3tic@mat.uni.torun.pl> 2007-03-19 http://d.puremagic.com/issues/show_bug.cgi?id=1068
author thomask
date Wed, 25 Apr 2007 17:46:32 +0000
parents 45c339264b57
children 516ef5730874
files run/t/template_62_A.d run/t/template_62_B.d
diffstat 2 files changed, 60 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/run/t/template_62_A.d	Wed Apr 25 17:46:32 2007 +0000
@@ -0,0 +1,38 @@
+// $HeadURL$
+// $Date$
+// $Author$
+
+// @author@	Tomasz Stachowiak <h3r3tic@mat.uni.torun.pl>
+// @date@	2007-03-19
+// @uri@	http://d.puremagic.com/issues/show_bug.cgi?id=1068
+// @desc@	[Issue 1068] stack corruption with mixins and function templates
+
+// __DSTRESS_DFLAGS__ run/t/template_62_B.d
+
+module /*dstress.*/run.t.template_62_A;
+
+template Mix() {
+	static void foobar() {
+		auto context = new Context;
+		context.func!(typeof(this))();
+	}
+}
+
+class Bar {
+	mixin Mix!();
+}
+
+void someFunc(char[] z) {
+	if(1 != z.length){
+		assert(0);
+	}
+	if("a" != z){
+		assert(0);
+	}
+}
+
+class Context {
+	void func(T)() {
+		someFunc(`a`);
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/run/t/template_62_B.d	Wed Apr 25 17:46:32 2007 +0000
@@ -0,0 +1,22 @@
+// $HeadURL$
+// $Date$
+// $Author$
+
+// @author@	Tomasz Stachowiak <h3r3tic@mat.uni.torun.pl>
+// @date@	2007-03-19
+// @uri@	http://d.puremagic.com/issues/show_bug.cgi?id=1068
+// @desc@	[Issue 1068] stack corruption with mixins and function templates
+
+// __DSTRESS_DFLAGS__ run/t/template_62_A.d
+
+module /*dstress.*/run.t.template_62_B;
+import /*dstress.*/run.t.template_62_A;
+
+class Foo {
+	mixin Mix;
+}
+
+int main() {
+	Bar.foobar();
+	return 0;
+}