# HG changeset patch # User thomask # Date 1177523192 0 # Node ID 891196dcfc3a4c4e748c80e20eeb4efc655dcb90 # Parent 45c339264b575b1e222fd206ba881f9733b22781 [Issue 1068] stack corruption with mixins and function templates Tomasz Stachowiak 2007-03-19 http://d.puremagic.com/issues/show_bug.cgi?id=1068 diff -r 45c339264b57 -r 891196dcfc3a run/t/template_62_A.d --- /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 +// @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`); + } +} diff -r 45c339264b57 -r 891196dcfc3a run/t/template_62_B.d --- /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 +// @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; +}