opDispatch shadowing toString - feature or bug?

Damian Ziemba nazriel at driv.pl
Thu Sep 1 01:28:03 PDT 2011


On Thu, 01 Sep 2011 07:56:49 +0000, Christophe wrote:

> Try to create the method:
> 
> const void toString(void delegate(const(char)[]) sink, string
> formatString) {
>   sink(toString());
> }

Adding it as it is results in compiler error:
	./quick.d(30): Error: function quick.Test2.toString () is not c	
allable using argument types () const
	./quick.d(30): Error: expected 2 function arguments, not 0
	./quick.d(30): Error: cannot implicitly convert expression 
(this.toString()) of type void to const(char)[]

Removing const from begging allows it to compile. But it doesn't change 
anything. Still "nothing" appears ;-)


More information about the Digitalmars-d-learn mailing list