On 28 September 2014 22:21, Andrei Alexandrescu via Digitalmars-d <digitalmars-d@puremagic.com> wrote: > On 9/27/14, 7:42 PM, Manu via Digitalmars-d wrote: >> >> void f() pure nothrow @nogc >> { >> void localFunc() >> { >> } >> >> localFunc(); >> } >> >> Complains because localFunc is not @nogc or nothrow. >> Doesn't complain about pure though. >> >> Is it reasonable to say that the scope of the outer function is >> nothrow+@nogc, and therefore everything declared within should also be >> so? > > > Interesting. I'd guess probably not, e.g. a function may define a static > local function and return its address (without either throwing or creating > garbage), whereas that local function itself may do whatever it pleases. > > However, local functions have their body available by definition so they > should have all deducible attributes deducted. That should take care of the > problem. > > > Andrei > > P.S. I also notice that my latest attempt at establishing communication has > remained ignored.
I was out of town (was on my phone), and now I'm home with 2 guests, and we're working together. I can't sit and craft a pile of example cases until I'm alone and have time to do so. I haven't ignored it, but I need to find the time to give you what you want. That said, my friend encountered one of my frequently recurring pain cases himself yesterday: struct S(T...) { void f(T args) {} } S!(int, ref S) fail; // <-- no clean way to do this. I need this very frequently, and he reached for it too, so I can't be that weird.