File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -2023,23 +2023,23 @@ $(H3 $(LNAME2 hex_string_literals, Hex String Literals))
2023
2023
2024
2024
$(SPEC_RUNNABLE_EXAMPLE_RUN
2025
2025
-------------
2026
- immutable uint[] data = cast(immutable uint[]) x"AABBCCDD";
2026
+ static immutable uint[] data = cast(immutable uint[]) x"AABBCCDD";
2027
2027
static assert(data[0] == 0xAABBCCDD);
2028
2028
-------------
2029
2029
)
2030
2030
2031
2031
$(P This requires the length of the hex string to be a multiple of the array element's size in bytes.)
2032
2032
$(SPEC_RUNNABLE_EXAMPLE_FAIL
2033
2033
-------------
2034
- auto e = cast(immutable ushort[]) x"AA BB CC";
2034
+ static e = cast(immutable ushort[]) x"AA BB CC";
2035
2035
// Error, length of 3 bytes is not a multiple of 2, the size of a `ushort`
2036
2036
-------------
2037
2037
)
2038
2038
2039
2039
$(P When a hex string literal gets constant folded, the result is no longer considered a hex string literal)
2040
2040
$(SPEC_RUNNABLE_EXAMPLE_FAIL
2041
2041
-------------
2042
- immutable byte[] b = x"AA" ~ "G"; // Error: cannot convert `string` to `immutable byte[]`
2042
+ static immutable byte[] b = x"AA" ~ "G"; // Error: cannot convert `string` to `immutable byte[]`
2043
2043
-------------
2044
2044
)
2045
2045
You can’t perform that action at this time.
0 commit comments