Add support implicit conversion between types

monarch_dodra monarchdodra at gmail.com
Sat Sep 7 13:15:00 PDT 2013


On Saturday, 7 September 2013 at 19:37:28 UTC, Maxim Fomin wrote:
> Actually D has this feature for classes:
>
> class A
> {
> 	this(int) {}
> }
>
> void foo(A a ...) {}
>
> void main()
> {
> 	foo(5);
> }
>
> This compiles and runs as expected. By the way, the code was 
> fixed recently - before 2.063 this was allocating class on 
> stack (so in D there were some kind of scoped stack classes), 
> now this allocates on heap as usual. I don't see the rationale 
> behind not working with structs.

I don't see the rationale for it working for classes at all!


More information about the Digitalmars-d mailing list