[Issue 8901] a bug to cast from array literal to ubyte[]

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Feb 8 22:51:30 UTC 2023


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

Paul Backus <snarwin+bugzilla at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
                 CC|                            |snarwin+bugzilla at gmail.com
         Resolution|---                         |INVALID

--- Comment #7 from Paul Backus <snarwin+bugzilla at gmail.com> ---
This behavior is documented in the "Casting" subsection of the "Array Literals"
section of the language spec [1]:

> When array literals are cast to another array type, each element of the array is cast to the new element type. When arrays that are not literals are cast, the array is reinterpreted as the new type, and the length is recomputed

According to the git history, this paragraph was introduced in 2009 by commit
8f99bfef0. So this has been the intended, documented behavior since before this
issue was first opened.

[1] https://dlang.org/spec/expression.html#cast_array_literal
[2]
https://github.com/dlang/dlang.org/commit/8f99bfef0#diff-38fe074d968a576648917dd82d0a11b502f2a8f35e39f920e929dbd6a4d2b407

--


More information about the Digitalmars-d-bugs mailing list