# HG changeset patch # User thomask # Date 1175329536 0 # Node ID ff8d07dc1454bc8585eabe0d91d6a28126b411da # Parent ca5b18e46ec7eac1ea9d855e13e81289df826a53 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 2007-03-11 http://d.puremagic.com/issues/show_bug.cgi?id=1052 diff -r ca5b18e46ec7 -r ff8d07dc1454 run/o/overload_28_A.d --- /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 +// @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; +}