Bug 512 – Assigning to constants in a forwarded constructor doesn't work

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P4
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Windows
Creation time
2006-11-15T05:49:00Z
Last change time
2014-02-15T13:20:47Z
Keywords
rejects-valid, spec
Assigned to
bugzilla
Creator
matti.niemenmaa+dbugzilla
Blocks
511

Comments

Comment #0 by matti.niemenmaa+dbugzilla — 2006-11-15T05:49:56Z
Under the "Const Attribute" section, the spec contains code like the following: class C { const int a; const int b; this() { a = 3; b = 2; } this(int x) { this(); // ok, forwarding constructor } } However, this code does not compile, producing errors: asdf.d(11): constructor asdf.C.this missing initializer for const field a asdf.d(11): constructor asdf.C.this missing initializer for const field b It seems to me that there's no particular reason why this shouldn't work, so I'm tagging this as "rejects-valid" as well as "spec".
Comment #1 by matti.niemenmaa+dbugzilla — 2007-04-21T11:20:43Z
789 is a duplicate of this bug, but as it's the one that's been marked fixed I'll mark this as the duplicate. *** This bug has been marked as a duplicate of 789 ***