Bug 10158 – 'offsetof' property of nested struct does not work properly
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-05-23T19:53:00Z
Last change time
2015-06-17T21:04:04Z
Keywords
iasm, rejects-valid
Assigned to
nobody
Creator
kekeniro2
Comments
Comment #0 by kekeniro2 — 2013-05-23T19:53:45Z
I tried to write inline assembly code,
but 'offsetof' of nested struct does not work properly.
Code:
class Outer {
static struct Inner {
int f;
}
// from member of Outer class
void test()
{
static assert( Inner.f.offsetof == 0); // NG
static assert( (Inner.f).offsetof == 0); // OK, but doesn't cooperate with the inline assembler
// Here comes asm { ... }.
}
}
// cf. from non-member of Outer class
void main()
{
static assert( Outer.Inner.f.offsetof == 0); // OK
}
Output:
offsetof_bug.d(9): Error: this for f needs to be type Inner not type offsetof_bug.Outer
Comment #1 by kekeniro2 — 2014-03-30T20:57:13Z
It seems to be fixed in 2.065.0.
right?
Comment #2 by github-bugzilla — 2015-04-02T13:14:31Z