D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 8088 - Inline assembler: Indexing struct fields not possible
Summary: Inline assembler: Indexing struct fields not possible
Status: RESOLVED INVALID
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords: iasm, rejects-valid
Depends on:
Blocks:
 
Reported: 2012-05-11 20:37 UTC by Denis Shelomovskii
Modified: 2020-03-21 03:56 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Denis Shelomovskii 2012-05-11 20:37:14 UTC
Example from http://dlang.org/iasm.html:
---
struct Foo { int a,b,c; }
int bar(Foo *f) {
    asm {
        mov EBX, f;
        mov EAX, Foo.b[EBX];
    }
}
---
main.d(5): Error: variable b cannot be read at compile time

Also see Issue 5302

Workaround: add .offsetof
Comment 1 basile-z 2019-07-23 01:12:48 UTC
The spec says that this syntax only works in the scope of the aggregate. Not the case here.