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

           Summary: inout is sticky to function return type
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: tomash.brec...@gmail.com


--- Comment #0 from Tomash Brechko <tomash.brec...@gmail.com> 2010-10-01 
14:57:27 PDT ---
Call to writeln(f(i)) below won't compile because dmd 2.049 thinks f() returns
"inout(int)", so "void writeln(T...)(T args)" expands to "void
writeln(inout(int)...(inout(int) args)", and inout parameter requires inout
return type.  Rewriting "void" as "inout(void)" helps, but obviously is wrong.

import std.stdio;

inout(int)
f(inout int i)
{
  return i;
}

void
main()
{
  int i;

  writeln(typeof(f(i)).stringof); // Outputs "inout(int)", not "int".

  int j = f(i);
  writeln(i); // Works OK :).

  writeln(f(i)); // Won't compile :(.
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to