Bug 22513 – ImportC: address of member of struct can’t be taken at compile time.

Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2021-11-14T22:43:08Z
Last change time
2021-12-14T10:34:23Z
Keywords
ImportC, pull, rejects-valid
Assigned to
No Owner
Creator
dave287091

Comments

Comment #0 by dave287091 — 2021-11-14T22:43:08Z
The following valid C code fails to compile: // staticvar.c int x = 0; int* y = &x; // ok struct Foo { int x; }; struct Foo f = {3}; int* z = &f.x; // error The message is: staticvar.c(10): Error: static variable `f` cannot be read at compile time
Comment #1 by dave287091 — 2021-11-14T22:58:47Z
The equivalent D code also fails to compile, but I don’t know if that is according to spec or not.
Comment #2 by dlang-bot — 2021-11-21T09:39:58Z
@WalterBright created dlang/dmd pull request #13334 "fix Issue 22513 - ImportC: address of member of struct cannot be take…" fixing this issue: - fix Issue 22513 - ImportC: address of member of struct cannot be taken at compile time https://github.com/dlang/dmd/pull/13334
Comment #3 by dlang-bot — 2021-11-23T03:02:21Z
dlang/dmd pull request #13334 "fix Issue 22513 - ImportC: address of member of struct cannot be take…" was merged into stable: - a84806c2adf478cb27120d6817f2d384d62f6a2c by Walter Bright: fix Issue 22513 - ImportC: address of member of struct cannot be taken at compile time https://github.com/dlang/dmd/pull/13334
Comment #4 by dlang-bot — 2021-12-14T10:34:23Z
dlang/dmd pull request #13421 "merge stable" was merged into master: - 0044dfd0bd91a5b420e8edab7cd6aff28e6e6e7b by Walter Bright: fix Issue 22513 - ImportC: address of member of struct cannot be taken at compile time https://github.com/dlang/dmd/pull/13421