[Issue 1172] New: Inline assembler: cannot access member of templated aggregate directly

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Apr 21 00:54:38 PDT 2007


http://d.puremagic.com/issues/show_bug.cgi?id=1172

           Summary: Inline assembler: cannot access member of templated
                    aggregate directly
           Product: D
           Version: 1.013
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: minor
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: deewiant at gmail.com


struct Foo(T) {
        int a;
}

void main() {
        Foo!(int) f;
        asm {
                mov EBX, f;
                mov EAX, Foo!(int).a[EBX];
        }
}

The code above is essentially the same as what is under "Struct/Union/Class
Member Offsets" at http://www.digitalmars.com/d/iasm.html but fails with the
error "bad type/size of operands 'Foo(T)'".

The workaround is to use an alias:

alias Foo!(int) Foo_int;
asm {
        mov EBX, f;
        mov EAX, Foo_int.a[EBX];
}


-- 



More information about the Digitalmars-d-bugs mailing list