Mercurial > projects > dstress
changeset 1147:90cf22616882
[Issue 349] New: Function matching with enums is erratic
Stewart Gordon <smjg@iname.com>
2006-09-15
news:bug-349-3@http.d.puremagic.com/issues/
author | thomask |
---|---|
date | Wed, 20 Sep 2006 19:11:31 +0000 |
parents | e6b33dbd93fe |
children | 4e9ac384388d |
files | compile/e/enum_48_A.d compile/e/enum_48_B.d compile/e/enum_48_C.d compile/e/enum_48_D.d run/e/enum_49_A.d run/e/enum_49_B.d run/e/enum_49_C.d run/e/enum_49_D.d |
diffstat | 8 files changed, 218 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/compile/e/enum_48_A.d Wed Sep 20 19:11:31 2006 +0000 @@ -0,0 +1,24 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Stewart Gordon <smjg@iname.com> +// @date@ 2006-09-15 +// @uri@ news:bug-349-3@http.d.puremagic.com/issues/ +// @desc@ [Issue 349] New: Function matching with enums is erratic + +module dstress.compile.e.enum_48_A; + +enum E : uint{ + A = 1 +} + +template T(uint a){ + const uint T = a + 1; +} + +template T(E e){ + const E T = e; +} + +static assert(T!(E.A) == E.A);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/compile/e/enum_48_B.d Wed Sep 20 19:11:31 2006 +0000 @@ -0,0 +1,24 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Stewart Gordon <smjg@iname.com> +// @date@ 2006-09-15 +// @uri@ news:bug-349-3@http.d.puremagic.com/issues/ +// @desc@ [Issue 349] New: Function matching with enums is erratic + +module dstress.compile.e.enum_48_B; + +enum E : uint{ + A = 1 +} + +template T(uint a){ + const uint T = a + 1; +} + +template T(E e){ + const E T = e; +} + +static assert(T!(1u) == 2);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/compile/e/enum_48_C.d Wed Sep 20 19:11:31 2006 +0000 @@ -0,0 +1,24 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Stewart Gordon <smjg@iname.com> +// @date@ 2006-09-15 +// @uri@ news:bug-349-3@http.d.puremagic.com/issues/ +// @desc@ [Issue 349] New: Function matching with enums is erratic + +module dstress.compile.e.enum_48_C; + +enum E : uint{ + A = 1 +} + +template T(uint a){ + const uint T = a + 1; +} + +template T(E e){ + const E T = e; +} + +static assert(T!(1) == 2);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/compile/e/enum_48_D.d Wed Sep 20 19:11:31 2006 +0000 @@ -0,0 +1,25 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Stewart Gordon <smjg@iname.com> +// @date@ 2006-09-15 +// @uri@ news:bug-349-3@http.d.puremagic.com/issues/ +// @desc@ [Issue 349] New: Function matching with enums is erratic + +module dstress.compile.e.enum_48_D; + +enum E : uint{ + A = 1 +} + +template T(uint a){ + const uint T = a + 1; +} + +template T(E e){ + const E T = e; +} + +const int i = 2; +static assert(T!(i) == 3);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/e/enum_49_A.d Wed Sep 20 19:11:31 2006 +0000 @@ -0,0 +1,30 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Stewart Gordon <smjg@iname.com> +// @date@ 2006-09-15 +// @uri@ news:bug-349-3@http.d.puremagic.com/issues/ +// @desc@ [Issue 349] New: Function matching with enums is erratic + +module dstress.run.e.enum_49_A; + +enum E : uint{ + A = 1 +} + +uint foo(E e){ + return e + 1u; +} + +uint foo(uint u){ + return u; +} + +int main(){ + if(foo(E.A) != 2){ + assert(0); + } + + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/e/enum_49_B.d Wed Sep 20 19:11:31 2006 +0000 @@ -0,0 +1,30 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Stewart Gordon <smjg@iname.com> +// @date@ 2006-09-15 +// @uri@ news:bug-349-3@http.d.puremagic.com/issues/ +// @desc@ [Issue 349] New: Function matching with enums is erratic + +module dstress.run.e.enum_49_B; + +enum E : uint{ + A = 1 +} + +uint foo(E e){ + return e + 1u; +} + +uint foo(uint u){ + return u; +} + +int main(){ + if(foo(1u) != 1){ + assert(0); + } + + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/e/enum_49_C.d Wed Sep 20 19:11:31 2006 +0000 @@ -0,0 +1,30 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Stewart Gordon <smjg@iname.com> +// @date@ 2006-09-15 +// @uri@ news:bug-349-3@http.d.puremagic.com/issues/ +// @desc@ [Issue 349] New: Function matching with enums is erratic + +module dstress.run.e.enum_49_C; + +enum E : uint{ + A = 1 +} + +uint foo(E e){ + return e + 1u; +} + +uint foo(uint u){ + return u; +} + +int main(){ + if(foo(1) != 1){ + assert(0); + } + + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/e/enum_49_D.d Wed Sep 20 19:11:31 2006 +0000 @@ -0,0 +1,31 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Stewart Gordon <smjg@iname.com> +// @date@ 2006-09-15 +// @uri@ news:bug-349-3@http.d.puremagic.com/issues/ +// @desc@ [Issue 349] New: Function matching with enums is erratic + +module dstress.run.e.enum_49_D; + +enum E : uint{ + A = 1 +} + +uint foo(E e){ + return e + 1u; +} + +uint foo(uint u){ + return u; +} + +int main(){ + int i = 1; + if(foo(i) != 1){ + assert(0); + } + + return 0; +}