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

--- Comment #0 from Tomash Brechko <> 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;

f(inout int i)
  return i;

  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:
------- You are receiving this mail because: -------

Reply via email to