need help to translate C into D

test123 test123 at gmail.com
Tue Sep 13 10:56:17 UTC 2022


On Tuesday, 13 September 2022 at 10:45:03 UTC, test123 wrote:
> upb_MiniTable_Enum array ?

2 type error I think it cloud be compiler bugs.


1): `expression `&validate_KnownRegex_enum_init_type(64u, 2u, 
[7u, 0u], ).header` is not a constant`

```d
     union validate_KnownRegex_enum_init_type { struct {uint a, b; 
uint[2] data;} upb_MiniTable_Enum header; }
     __gshared const validate_KnownRegex_enum_init_type 
validate_KnownRegex_enum_init = { 64, 2, [7, 0] };
     __gshared const upb_MiniTable_Enum*[1] __enums_layout = [
         &validate_KnownRegex_enum_init.header,
     ];
```

2:) `Error: reinterpreting cast from 
`const(validate_KnownRegex_enum_init_type)*` to 
`const(upb_MiniTable_Enum)*` is not supported in CTFE`

```d
     struct validate_KnownRegex_enum_init_type { uint a, b; 
uint[2] data;}
     __gshared const validate_KnownRegex_enum_init_type 
validate_KnownRegex_enum_init = { 64, 2, [7, 0] };
     __gshared const upb_MiniTable_Enum*[1] __enums_layout = [
         cast(const upb_MiniTable_Enum*) 
&validate_KnownRegex_enum_init,
     ];
```


More information about the Digitalmars-d-learn mailing list