www.digitalmars.com         C & C++   DMDScript  

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

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: html exc.eu


--- Comment #0 from Christian Schneider <html 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: -------
Apr 26 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9996


bearophile_hugs eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs eml.cc


--- Comment #1 from bearophile_hugs eml.cc 2013-04-26 12:16:11 PDT ---
I think this is a dupe.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 26 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9996


Denis Shelomovskij <verylonglogin.reg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |verylonglogin.reg gmail.com
         Resolution|                            |DUPLICATE


--- Comment #2 from Denis Shelomovskij <verylonglogin.reg gmail.com> 2013-06-10
16:43:09 MSD ---
Same test (except `join` is used instead of `array`) as in Issue 4841
description.

*** This issue has been marked as a duplicate of issue 4841 ***

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