Mercurial > projects > dstress
changeset 1439:ff8d07dc1454
r7387@birke: tk | 2007-03-29 15:49:47 +0200
[Issue 1052] DMD 1.009 - aliasing functions from superclasses may result in incorrect conflicts
Tomasz Stachowiak <h3r3tic@mat.uni.torun.pl>
2007-03-11
http://d.puremagic.com/issues/show_bug.cgi?id=1052
author | thomask |
---|---|
date | Sat, 31 Mar 2007 08:25:36 +0000 |
parents | ca5b18e46ec7 |
children | 5224177dd804 |
files | run/o/overload_28_A.d |
diffstat | 1 files changed, 50 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/o/overload_28_A.d Sat Mar 31 08:25:36 2007 +0000 @@ -0,0 +1,50 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Tomasz Stachowiak <h3r3tic@mat.uni.torun.pl> +// @date@ 2007-03-11 +// @uri@ http://d.puremagic.com/issues/show_bug.cgi?id=1052 +// @desc@ [Issue 1052] DMD 1.009 - aliasing functions from superclasses may result in incorrect conflicts + +module dstress.run.o.overload_28_A; + +class Parent{ + int func(int a) { + return a * 2; + } +} + +class Child : Parent { + alias Parent.func func; +} + +class GrandChild : Child { + alias Child.func func; + + void func(char[] a) { + return a.length * 3; + } +} + +int main(){ + Parent p = new Parent(); + if(-4 != p.func(-2)){ + assert(0); + } + + p = new Child(); + if(-4 != p.func(-2)){ + assert(0); + } + + p = new GrandChild(); + if(-4 != p.func(-2)){ + assert(0); + } + if(3 != p.func("a")){ + assert(0); + } + + return 0; +}