April 28, 2006
http://d.puremagic.com/bugzilla/show_bug.cgi?id=116

           Summary: Inline Assembler offset keyword
           Product: D
           Version: 0.155
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: accepts-invalid, diagnostic, wrong-code
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: lugaidster@gmail.com


The compiler confuses offset keyword in the inline assembler with .offsetof property and issues a deprecated keyword error. This is easily reproduced by compiling the following:

CODE:

int[5] bar;

void foo()
{
  asm
  {
    mov ECX,offset bar;
  }
}

a workaround would be to do this:

int[5] bar;

void foo()
{
  void* pbar = &bar;
  asm
  {
    mov ECX,pbar;
  }
}

after issuing the error it says to use offsetof instead, and when you write:

int[5] bar;

void foo()
{
  asm
  {
    mov ECX,offsetof bar;
  }
}

it compiles and runs until a runtime error is issued.


--