toString multiple overrides

Jacob Carlborg doob at me.com
Sat Feb 11 04:11:16 PST 2012


On 2012-02-11 05:41, Ellery Newcomer wrote:
> dmd 2.057
>
> Two mixin templates, each define toString, mix them in to your class and ..
>
> Error: function test.X.T2!().toString multiple overrides of same function
>
> So this behavior is new, but is it sensical?
>
>
> Sample code:
>
> mixin template T1(){
> string toString(){
> return "1";
> }
> }
> mixin template T2(){
> string toString(){
> return "2";
> }
> }
> class X{
> mixin T1!() a;
> mixin T2!() b;
> }
>
> void main(){
> }

Shouldn't it be legal since you can qualify the call to toString with 
the mixin do disambiguate the call?

-- 
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list