looking for work-around: _d_assocarrayliteralTX segfault assigning a shared associative array an AA literal

Steven Schveighoffer schveiguy at gmail.com
Wed Jun 14 02:14:59 UTC 2023


On 6/13/23 10:02 PM, Steven Schveighoffer wrote:

> I need to diagnose further, but most *likely* the problem is that the 
> typeinfo being passed is incorrect (I believe it's a TypeInfo_Shared, 
> but the function is expecting a TypeInfo_AssociativeArray)
> 

Further diagnosis is that the `TypeInfo` being passed in is still 
wrapped in a `TypeInfo_Shared`.

If you do `const aa = ["abc": "123"]` or `immutable aa = ["abc": "123"]` 
then the typeinfo is not wrapped in `TypeInfo_Const` or `TypeInfo_Shared`

This explains exactly why there is a bug.

I put the following line at the top of that function, and it fails in 
the `shared` case:

```d
assert(typeid(ti) == typeid(TypeInfo_AssociativeArray));
```

If there isn't a bug I'll file one.

-Steve


More information about the Digitalmars-d-learn mailing list