Why is the following failing?

ryuukk_ ryuukk.dev at gmail.com
Thu Jan 25 19:44:40 UTC 2024


On Thursday, 25 January 2024 at 17:50:57 UTC, Johan wrote:
> 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";
> }
> ```


I created an issue and included that case


https://issues.dlang.org/show_bug.cgi?id=24355


More information about the Digitalmars-d-learn mailing list