Postblit bug

IgorStepanov via Digitalmars-d digitalmars-d at puremagic.com
Fri Oct 17 12:39:39 PDT 2014


On Friday, 17 October 2014 at 17:25:47 UTC, monarch_dodra wrote:
> On Friday, 17 October 2014 at 16:19:47 UTC, IgorStepanov wrote:
>> It's just common words=)
>> I meant that when postblit is called when new object is being 
>> creating and doesn't exists for user code.
>> E.g.
>> const S v1 = v2;
>> Ok, v1 _will_ be const when it will be _created_.
>> However postblit can think that object is mutable, because it 
>> called before the first accessing to the object from user code.
>> Thus I ask about case when postblit may mutate a const object, 
>> which created before postblitted object and may been accessed 
>> from user code before this postblitting.
>
> That's way too many words for a single sentence for me to 
> understand ;)

Yes, my english is so bad:)

> But maybe this answers your question?
Yes, I've understood.

TBH, I have got this error while I am working on new AA, and I 
want to fix it as posdible faster (one way or another).
I have the next code:
struct AssociativeArray(Key, Value)
{
...
    struct Entry
    {
       Key key;
       Value value;
       ...
    }
}
If key or value is a const struct with postblit I have got a 
error.
I don't need an any postblit in Entry.
Thus I suggest another solution:
Do not generate helper functions like __fieldPostBlit, if struct 
has a @disabled this(this);
Destroy it.


More information about the Digitalmars-d mailing list