www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22595] New: Error: integer constant expression expected


          Issue ID: 22595
           Summary: Error: integer constant expression expected instead of
           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;

  asm {
    mov RAX, 60;
    mov RDI, 0;

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