Thread overview
[Issue 1172] Inline assembler: cannot access member of templated aggregate directly
Jul 12, 2019
RazvanN
Jul 12, 2019
Basile-z
Mar 21, 2020
Basile-z
July 12, 2019
https://issues.dlang.org/show_bug.cgi?id=1172

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

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

--- Comment #2 from RazvanN <razvan.nitu1305@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

--
July 12, 2019
https://issues.dlang.org/show_bug.cgi?id=1172

Basile-z <b2.temp@gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |b2.temp@gmx.com
         Resolution|---                         |WONTFIX

--- Comment #3 from Basile-z <b2.temp@gmx.com> ---
I agree. Generally speaking in asm D expressions allowed must give either a constant or variable. member function access is already more complex.

--
March 21, 2020
https://issues.dlang.org/show_bug.cgi?id=1172

Basile-z <b2.temp@gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|b2.temp@gmx.com             |

--