Bug 3620 – Address of member of global struct isn't constant

Status
RESOLVED
Resolution
WONTFIX
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
All
OS
All
Creation time
2009-12-16T07:10:47Z
Last change time
2019-08-10T18:33:37Z
Keywords
rejects-valid
Assigned to
No Owner
Creator
FeepingCreature

Attachments

IDFilenameSummaryContent-TypeSize
524constant-global-member.patchMake address of member of global struct constanttext/plain600

Comments

Comment #0 by default_357-line — 2009-12-16T07:10:47Z
Created attachment 524 Make address of member of global struct constant When taking the address of a member of a global struct, as in struct S { int x; } S s; const int* p = &s.x; The above fails on 1.051 with "Error: non-constant expression &s.x" The attached patch fixes this.
Comment #1 by default_357-line — 2009-12-23T21:31:08Z
Nevermind, seems it breaks Tango .. somehow. http://www.dsource.org/projects/ldc/ticket/384 Color me confused.
Comment #2 by clugdbug — 2010-01-13T00:31:13Z
Removing 'patch' keyword since the patch is known to be incorrect.
Comment #3 by pro.mathias.lang — 2019-08-10T18:33:37Z
I don't think we can even make them constant. Not in a way that could be used in CTFE anyway (because there could be a linker script, or just PIC / PIE). So going to close this as WONTFIX.