Bug 13891 – __gshared/static anonymous union members do not overlap

Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2014-12-25T08:48:15Z
Last change time
2024-12-13T18:38:34Z
Assigned to
No Owner
Creator
Vlad Levenfeld
Moved to GitHub: dmd#18924 →

Comments

Comment #0 by vlevenfeld — 2014-12-25T08:48:15Z
struct Foo { union { int a; int b; } } struct Bar { __gshared union { // also fails if __gshared -> static int a; int b; } } void main (string[] args) { Foo x; Bar y; assert (cast(uint)(&x.a) == cast(uint)(&x.b)); // PASS assert (cast(uint)(&y.a) == cast(uint)(&y.b)); // FAIL }
Comment #1 by nick — 2024-09-21T19:53:42Z
Still happens with 2.109. Also: pragma(msg, Foo.b.offsetof); // 0 pragma(msg, Bar.b.offsetof); // Error: no property `offsetof` for `b` of type `int`
Comment #2 by robert.schadek — 2024-12-13T18:38:34Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/18924 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB