x.RC.__postblit () is not callable using argument types () const
    Dan 
    dbdavidson at yahoo.com
       
    Tue Feb  5 09:05:22 PST 2013
    
    
  
On Tuesday, 5 February 2013 at 16:36:16 UTC, Maxim Fomin wrote:
> This does not imply such situation, simply there is a problem. 
> You can workaround by
>
[snip]
> struct RC {
>     int i;
>     void postblit() { i = -5; }
>     this(this) const
>     {
>         void delegate() dg = &postblit;
>         dg();
>     }
> }
Great thanks. I'll try.
But why does this even code work? I would have thought const 
guarantee would prevent calls to non-const postblit function. I 
was under impression this(this) const does not work - but maybe 
that has changed with 2.061.
What source (lang spec, TDPL, or newsgroup) led you to this 
solution and for how long will it be valid? Where can I read more 
on it?
Thanks
Dan
    
    
More information about the Digitalmars-d-learn
mailing list