@ DMD 2.050 An instruction like: mov EAX, Struct.field[EDX]; compiles OK in free functions, but when inside a member function, the compiler complains about a wrong type of 'this' for type Struct.
Please, if possible add a complete minimal program that shows the problem.
Created attachment 836 [details] Failing code
Comment on attachment 836 [details] Failing code Compiling this results in the following error message: iasm_test.d(15): Error: this for i needs to be type S not type iasm_test.A iasm_test.d(15): bad type/size of operands '(__error).i'
The attachment: module iasm_test; struct S { uint i; } class A { uint func(S* s) { asm { mov EDX, s; mov EAX, S.i[EDX]; } } }
The parser for the iasm operator expressions is quite limited compared with the regular D expressions is quite limited. It is also different in order to be like the Intel assembler syntax. However, this case can be handled using: mov EAX, S.i.offsetof[EDX]; instead of: mov EAX, S.i[EDX]; Marked as invalid because there is a way to make it work.