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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jul 12 11:01:58 UTC 2019


https://issues.dlang.org/show_bug.cgi?id=1172

RazvanN <razvan.nitu1305 at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |razvan.nitu1305 at gmail.com

--- Comment #2 from RazvanN <razvan.nitu1305 at gmail.com> ---
You can also use f instead of the type as a workaround:

struct Foo(T) {
        int a;
}

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

It is actually easier to type the name of the variable.

It seems that the ASM parser is really simple, it doesn't support all the
complex grammar that D has to offer. You can take a look at the grammar [1] and
see that it only accepts simple dotIdentifiers (templates not included).

I suggest we close this as WONTFIX.

[1] https://dlang.org/spec/iasm.html#operands

--


More information about the Digitalmars-d-bugs mailing list