digitalmars.D.bugs - [Issue 22595] New: Error: integer constant expression expected
- d-bugmail puremagic.com (41/41) Dec 13 2021 https://issues.dlang.org/show_bug.cgi?id=22595
https://issues.dlang.org/show_bug.cgi?id=22595 Issue ID: 22595 Summary: Error: integer constant expression expected instead of `"Hello!\x0a"` Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: rempas tutanota.com I'm trying to compile the following code: ``` extern (C) void _start() { const char* hello = "Hello!\n"; ulong len = 7; asm { mov RAX, 1; mov RDI, 1; mov RSI, hello; mov RDX, len; syscall; }; asm { mov RAX, 60; mov RDI, 0; syscall; }; } ``` and I am using the following command: `dmd test.d -betterC -Xcc="-nostdlib" -O -of=testd` This will compile normally if I use ldc2 but with dmd, it will give me the error message in the title. If I change `const char*` to `char*` (of course I will also have to cast the string literal) then it will compile normally. Any ideas? It doesn't make sense for this to be the behavior right? --
Dec 13 2021