Thread overview
[Issue 22595] Error: integer constant expression expected instead of `"Hello!\x0a"`
Apr 13, 2022
Dennis
Dec 17, 2022
Iain Buclaw
April 13, 2022
https://issues.dlang.org/show_bug.cgi?id=22595

Dennis <dkorpel@live.nl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dkorpel@live.nl

--- Comment #1 from Dennis <dkorpel@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.

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=22595

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P3

--
December 13
https://issues.dlang.org/show_bug.cgi?id=22595

--- Comment #2 from dlangBugzillaToGithub <robert.schadek@posteo.de> ---
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/dmd/issues/20022

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB

--