# HG changeset patch # User thomask # Date 1178515286 0 # Node ID 457db939477115f4bb50a2e4cf33cfb6c80c6511 # Parent 89775df1607d73edebba386254e3182ea879e705 [Issue 1204] segfault using struct in CTFE Don Clugston 2007-04-30 http://d.puremagic.com/issues/show_bug.cgi?id=1204 diff -r 89775df1607d -r 457db9394771 compile/s/struct_30_C.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/compile/s/struct_30_C.d Mon May 07 05:21:26 2007 +0000 @@ -0,0 +1,26 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Don Clugston +// @date@ 2007-04-30 +// @uri@ http://d.puremagic.com/issues/show_bug.cgi?id=1204 +// @desc@ [Issue 1204] segfault using struct in CTFE + +module dstress.compile.s.struct_30_C; + +struct S { + int a = 0xABCD_1234; + int b = 0xC0FF_EEEE; +} + +S foo(){ + int q = 0; + int unused; + int unused2; + return S(q, 0); +} + +const s = foo(); +static assert(0xABCD_1234 == s.a); +static assert(0xC0FF_EEEE == s.b); diff -r 89775df1607d -r 457db9394771 compile/s/struct_30_D.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/compile/s/struct_30_D.d Mon May 07 05:21:26 2007 +0000 @@ -0,0 +1,25 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Don Clugston +// @date@ 2007-04-30 +// @uri@ http://d.puremagic.com/issues/show_bug.cgi?id=1204 +// @desc@ [Issue 1204] segfault using struct in CTFE + +module dstress.compile.s.struct_30_D; + +struct S { + int a = 0xABCD_1234; + int b = 0xC0FF_EEEE; +} + +S foo(){ + int q = 0; + int unused; + return S(q, 0); +} + +const s = foo(); +static assert(0xABCD_1234 == s.a); +static assert(0xC0FF_EEEE == s.b); diff -r 89775df1607d -r 457db9394771 run/s/struct_30_A.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/s/struct_30_A.d Mon May 07 05:21:26 2007 +0000 @@ -0,0 +1,31 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Don Clugston +// @date@ 2007-04-30 +// @uri@ http://d.puremagic.com/issues/show_bug.cgi?id=1204 +// @desc@ [Issue 1204] segfault using struct in CTFE + +module dstress.run.s.struct_30_A; + +struct S { + int a = 0xABCD_1234; + int b = 0xC0FF_EEEE; +} + +S foo(){ + int q = 0; + int unused; + int unused2; + return S(q, 0); +} + +int main(){ + const s = foo(); + if((0xABCD_1234 != s.a) || (0xC0FF_EEEE != s.b)){ + assert(0); + } + + return 0; +} diff -r 89775df1607d -r 457db9394771 run/s/struct_30_B.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/s/struct_30_B.d Mon May 07 05:21:26 2007 +0000 @@ -0,0 +1,30 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Don Clugston +// @date@ 2007-04-30 +// @uri@ http://d.puremagic.com/issues/show_bug.cgi?id=1204 +// @desc@ [Issue 1204] segfault using struct in CTFE + +module dstress.run.s.struct_30_B; + +struct S { + int a = 0xABCD_1234; + int b = 0xC0FF_EEEE; +} + +S foo(){ + int q = 0; + int unused; + return S(q, 0); +} + +int main(){ + const s = foo(); + if((0xABCD_1234 != s.a) || (0xC0FF_EEEE != s.b)){ + assert(0); + } + + return 0; +}