ddmdvibed

Creating new types using Typedef on Vibe.data.json.Json, implicit conversion error


I needed to have multiple types of Json so I used Typedef as following:

 alias NewType = Typedef!(Json);

I am using Vibe.d Json version, I get the following message when compiling using DMD64 D Compiler v2.072.0:

Error: cannot implicitly convert expression ([cast(ubyte)0u, cast(ubyte)0u, cast(ubyte)0u, cast(ubyte)0u, cast(ubyte)0u, cast(ubyte)0u, cast(ubyte)0u, cast(ubyte)0u, cast(ubyte)0u, cast(ubyte)0u, cast(ubyte)0u, cast(ubyte)0u, cast(ubyte)0u, cast(ubyte)0u, cast(ubyte)0u, cast(ubyte)0u, cast(ubyte)0u, cast(ubyte)0u, cast(ubyte)0u, cast(ubyte)0u, cast(ubyte)0u, cast(ubyte)0u, cast(ubyte)0u, cast(ubyte)0u, cast(ubyte)0u, cast(ubyte)0u, cast(ubyte)0u, cast(ubyte)0u, cast(ubyte)0u, cast(ubyte)0u, cast(ubyte)0u, cast(ubyte)0u]) of type ubyte[] to void[32]

I read the documentation and did not find any limitations for using Typedef.


Solution

  • It is an error in Typedef it seems it is not able to alias a type which use array of type void, Same problem exist with JSONValue from std_data_json. In this case I change this line: https://github.com/s-ludwig/taggedalgebraic/blob/master/source/taggedalgebraic.d#L58 to ubyte type and it is working now. I will try look at it further and fix it.

    Issue link