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

           Summary: Compiling certain nested structs with -inline causes
                    error "*** is a nested function and cannot be accessed
                    from ***"
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Linux
            Status: NEW
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: torar...@gmail.com


--- Comment #0 from Torarin <torar...@gmail.com> 2011-12-18 15:27:19 PST ---
This regression was introduced with the 2.057 release.

I first hit the issue with code resembling the following:
---------------------------------------------------------
import std.stdio, std.algorithm;

void main() {
 writeln(filter!"a != 'r'"("Merry Christmas!"));
}
--------------------------------------------------------
Compiling with -inline gives:
/src/phobos/std/algorithm.d(1120): Error: function
std.algorithm.filter!("a != 'r'").filter!(string).filter is a nested
function and cannot be accessed from formatValue

This reduced test case gives a clue as to what is going on:
---------------------------------------------------------
auto fun()
{
 struct Result {
   this(int u) {}

   auto bar() {
       return Result(0);
   }
 }
 return Result();
}

void main() {
 auto t = fun();
 auto a = t.bar();
}
---------------------------------------------------------
Compiled with -inline:
t.d(7): Error: function t.fun is a nested function and cannot be
accessed from main

It seems what is happening is that bar is being inlined in main, but
dmd doesn't know where to get the new fun.Result's context pointer
from.

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

Reply via email to