On 7 October 2016 at 05:58, Jinx via Digitalmars-d <digitalmars-d@puremagic.com> wrote: > On Thursday, 6 October 2016 at 15:00:56 UTC, Manu wrote: >> >> On 6 October 2016 at 00:29, Manu <turkey...@gmail.com> wrote: >>> >>> On 4 October 2016 at 11:15, Manu <turkey...@gmail.com> wrote: >>>> >>>> [...] >>> >>> >>> I'm really struggling with this issue.. multiple times a day. >>> I can't find a reasonable workaround. casting, or trying to re-synth >>> the delegate type from the function signature doesn't seem to be >>> reasonable. I lose all the attributes, and storage class on parameters >>> are an endless nuisance that should never have existed. Cloning the >>> function signature verbatim, but with inout resolved seems to be >>> really hard and probably buggy. >>> I really just need this bug fixed... is it a particularly tricky fix? >> >> >> Goodnight. I'm really hoping I wake up tomorrow and someone has some >> comment on this issue... >> I'm a post about it every day. I'm completely blocked while this >> regression stands ;) > > > Why not make a template function that does the necessary conversion? Going > from the delegate to a void* then back again with the appropriate attributes > applied by a cast?
storage class and attributes are so hard to work with. It's a serious pain to do what you suggest. Since this is a bug (and a very recent regression no less), I just want it fixed so I can get on with it. Writing massively complex workarounds for it is just not worth the energy. Seriously, I'm sure I could spend a whole day on it trying to cover all cases! Perhaps you'd like to give it a go ;) Something like: template delegateTypeForInoutMethod(T, string method) { alias delegateTypeForInoutMethod = [write lots of stuff here]; } struct S { inout(int)[] f(ref const(int) arg) inout pure nothrow { return [ arg ]; } } static assert(delegateTypeForInoutMethod!(const(S), "f") == const(int)[] delegate(ref const(int)) pure nothrow, "You failed!");