<div class="gmail_quote">On Sun, Jun 27, 2010 at 10:11, Simen kjaeraas <span dir="ltr">&lt;<a href="mailto:simen.kjaras@gmail.com">simen.kjaras@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
auto fn1 = ( string s ) {<br>
        return s;<br>
};<br>
<br>
auto fn2 = ( string s ) {<br>
        return map!fn1( [&quot;&quot;] );<br>
};<br>
<br>
auto idirs = map!fn2( [&quot;&quot;] );<br>
<br>
The above code gives the following errors:<br>
foo.d(114): Error: struct foo.main.Map!(fn2,string[]).Map inner struct<br>
Map cannot be a field<br>
foo.d(114): Error: struct foo.main.Map!(fn2,string[]).Map inner struct<br>
Map cannot be a field<br>
<br>
As far as I can see, this has to do with struct rules, but I can&#39;t see<br>
how to fix it. Should I file this in bugzilla?<br><br></blockquote><div><br>I&#39;ve had this particular error dozens of time :-(   Most of the time, it means the function you passed to (the outer) Map is not correct, be it a template that has trouble instantiating, a type mismatch or some frame pointer that got lost.<br>
In your case, I guess there is a bug somewhere concerning the passing around of delegates. If you get rid of delegates (which is not what you want, I know), it works:<br><br>string fn1(string s) { return s;}<br>auto fn2(string s) { return map!fn1([&quot;&quot;]);}<br>
<br>void main()<br>{<br>    auto idirs = map!fn2([&quot;&quot;]); // works.<br>}<br><br>I tried defining fn1 inside fn2, but it does not work. Too bad.<br><br><br>Philippe<br><br><br><br></div></div>