[Issue 2621] ref binds to rvalues of user-defined types

2015-06-09 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=2621

Andrei Alexandrescu  changed:

   What|Removed |Added

Version|unspecified |D2

--


[Issue 2621] ref binds to rvalues of user-defined types

2009-03-11 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=2621


bugzi...@digitalmars.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED




--- Comment #2 from bugzi...@digitalmars.com  2009-03-11 14:57 ---
Fixed dmd 2.026


-- 



[Issue 2621] ref binds to rvalues of user-defined types

2009-01-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=2621





--- Comment #1 from and...@metalanguage.com  2009-01-27 09:48 ---
(In reply to comment #0)
> struct Struct {}
> alias Struct T;
> //alias int T;
> 
> T fun() { return T(); }
> void gun(ref T) {}
> void main()
> {
> gun(fun);
> }
> 
> The code compiles and it shouldn't. ref should never bind to rvalues. 
> Currently
> indeed it doesn't bind to rvalues of built-in type (e.g. if the alias above is
> switched from Struct to int the code won't compile).
> 

Furthermore, adding this overload should make the code work:

void gun(T) {}

Currently adding the overload results in the error message:

function test.gun called with argument types:
(Struct)
matches both:
test.gun(ref Struct _param_0)
and:
test.gun(Struct _param_0)


--