x.RC.__postblit () is not callable using argument types () const

Maxim Fomin maxim at maxim-fomin.ru
Tue Feb 5 07:06:46 PST 2013


On Tuesday, 5 February 2013 at 12:35:25 UTC, Dan wrote:
> Is it the case that this is a D compiler (or library) problem 
> and there is no issue with the code? Or is there really a 
> problem with it that I am not seeing? I gather from the 
> responses the code looks fine, otherwise any misunderstanding 
> would come up quickly.

This is compiler problem.

> Transitive const is more than just simple const, and obviously 
> more is better ;-). Since "Slot" is mentioned and 
> "object.AssociativeArrray" it sounds like there may be a 
> const-correctness issue with associative array itself rather 
> than this code? Before the move to 2.061 I had to cast away 
> const on const(V[K]) to get length and to iterate over them. 
> But why the link between History!double and RC[int] when they 
> are totally unrelated? Well, the only relation is their 
> aggregation in BSItem. Baffling.

The root of the problem is in:

struct DAssociativeArray(Key, Value)
{
     struct Slot
     {
         Value value;
     }
}

struct RC {
   this(this) {  }
}

void main()
{
     DAssociativeArray!(int, const(RC)) goo;
}

which doesn't compile (this is how Value[Key] is rewritten).


> Any suggestions appreciated.
> Thanks
> Dan



More information about the Digitalmars-d-learn mailing list