[Issue 9996] New: Outer variable in nested function cannot be accessed. (-inline)

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Apr 26 09:56:18 PDT 2013


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

           Summary: Outer variable in nested function cannot be accessed.
                    (-inline)
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: html at exc.eu


--- Comment #0 from Christian Schneider <html at exc.eu> 2013-04-26 09:56:17 PDT ---
DMD 2.062, x86/Linux

test.d:
------------------------------------------------------------
import std.algorithm;
import std.array;
import std.string;

string[] arr = ["param"];

void main()
{
  bool b;
  string i(string n) { return n ~ (b ? "b" : "a"); }
  arr.map!i().join(", ");
}
------------------------------------------------------------
dmd -inline test.d
------------------------------------------------------------
test.d(10): Error: function D main is a nested function and cannot be accessed
from std.array.join!(MapResult!(i, string[]), string).join
test.d(10): Error: function D main is a nested function and cannot be accessed
from std.array.join!(MapResult!(i, string[]), string).join
test.d(10): Error: function D main is a nested function and cannot be accessed
from std.array.join!(MapResult!(i, string[]), string).join

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


More information about the Digitalmars-d-bugs mailing list