Why is the following failing?

Johan j at j.nl
Thu Jan 25 17:50:57 UTC 2024


On Thursday, 25 January 2024 at 16:07:44 UTC, Stefan Koch wrote:
> On Thursday, 25 January 2024 at 15:39:08 UTC, ryuukk_ wrote:
>> ```D
>> void main()
>> {
>>     char[32] id = 0;
>>     id = "hello";
>> }
>>
>> ```
>>
>> this works fine, and that is what i expect for the example 
>> above..
>
> Raise a bug, I'll fix it.

Hmm.

To me, the bug is that string assignment to the array is allowed. 
Because this also compiles without any compile error:

```D
void main()
{
     char[4] id;
     id = "hello asdad";
}
```



More information about the Digitalmars-d-learn mailing list