Bug 2382 – spec is not clear on what is allowed as global/static initializers

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
All
Creation time
2008-10-01T18:48:00Z
Last change time
2014-02-15T13:12:53Z
Keywords
spec
Assigned to
nobody
Creator
tomas

Comments

Comment #0 by tomas — 2008-10-01T18:48:22Z
I can't find anywhere in the spec where it's clarified what can be used as a global/static initializer (only some special cases, like static struct initializers) for example it's valid to initialize a global with the address of a function, statically. however, for example, it's not allowed to cast this function pointer to an integer even though there's no technical reason this should not be allowed.
Comment #1 by bugzilla — 2012-01-22T14:43:45Z
Casting a pointer to an int may require halving its size, and the object file format often does not support that.
Comment #2 by github-bugzilla — 2012-01-22T14:45:31Z