Mercurial > projects > dstress
changeset 750:87cc8f744369
Don Clugston <dac@nospam.com.au>
2005-11-14
news:dladdb$1vp4$1@digitaldaemon.com
author | thomask |
---|---|
date | Sat, 19 Nov 2005 21:57:54 +0000 |
parents | 8e0dd2bbbd87 |
children | 779bb58f8d2b |
files | run/t/template_18_A.d run/t/template_18_B.d |
diffstat | 2 files changed, 69 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/t/template_18_A.d Sat Nov 19 21:57:54 2005 +0000 @@ -0,0 +1,37 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Don Clugston <dac@nospam.com.au> +// @date@ 2005-11-14 +// @uri@ news:dladdb$1vp4$1@digitaldaemon.com + +module dstress.run.t.template_18_A; + +template outside(alias s){ + const int outval = s.localval; +} + +template test(alias f){ + template local(){ + const int localval = f.x; + } + + const int val = outside!(local!()).outval; +} + +template a(){ + const int x = 123; +} + +template b(){ + const int x = 456; +} + +int main(){ + static assert( test!( a!() ).val == 123); + static assert( test!( b!() ).val == 456); + + return 0; +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/t/template_18_B.d Sat Nov 19 21:57:54 2005 +0000 @@ -0,0 +1,32 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Don Clugston <dac@nospam.com.au> +// @date@ 2005-11-14 +// @uri@ news:dladdb$1vp4$1@digitaldaemon.com + +module dstress.run.t.template_18_B; + +template outside(alias s){ + const int outval = s.localval; +} + +template test(alias f){ + template local(){ + const int localval = f.x; + } + + const int val = outside!(local!()).outval; +} + +template a(){ + const int x = 123; +} + +int main(){ + static assert( test!( a!() ).val == 123); + + return 0; +} +