[Issue 22595] Error: integer constant expression expected instead of `"Hello!\x0a"`
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Apr 13 11:48:48 UTC 2022
https://issues.dlang.org/show_bug.cgi?id=22595
Dennis <dkorpel at live.nl> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |dkorpel at live.nl
--- Comment #1 from Dennis <dkorpel at live.nl> ---
The problem is that the compiler tries to constant fold when `hello` is `const`
(hence available at compile time), but directly assigning a string literal to a
register is not supported yet.
The best workaround is to define `const(char)* hello = "Hello!\n";`, meaning
the string data is const, but the pointer is mutable.
--
More information about the Digitalmars-d-bugs
mailing list