[Issue 22595] New: Error: integer constant expression expected instead of `"Hello!\x0a"`
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Dec 13 20:59:19 UTC 2021
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 at puremagic.com
Reporter: rempas at 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?
--
More information about the Digitalmars-d-bugs
mailing list