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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jan 27 07:44:38 PST 2009


http://d.puremagic.com/issues/show_bug.cgi?id=2621

           Summary: ref binds to rvalues of user-defined types
           Product: D
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: andrei at metalanguage.com


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).


-- 



More information about the Digitalmars-d-bugs mailing list