@ 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.
Comment #1 by bearophile_hugs — 2010-12-01T12:29:54Z
Please, if possible add a complete minimal program that shows the problem.
Comment #2 by htvennik — 2010-12-02T07:52:48Z
Created attachment 836
Failing code
Comment #3 by htvennik — 2010-12-02T07:55:26Z
Comment on attachment 836
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'
Comment #4 by bugzilla — 2020-08-20T08:48:46Z
The attachment:
module iasm_test;
struct S
{
uint i;
}
class A
{
uint func(S* s)
{
asm
{
mov EDX, s;
mov EAX, S.i[EDX];
}
}
}
Comment #5 by bugzilla — 2020-08-21T06:42:32Z
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.