digitalmars.D.bugs - [Issue 512] New: Assigning to constants in a forwarded constructor doesn't work
- d-bugmail puremagic.com (36/36) Nov 15 2006 http://d.puremagic.com/issues/show_bug.cgi?id=512
- d-bugmail puremagic.com (11/11) Apr 21 2007 http://d.puremagic.com/issues/show_bug.cgi?id=512
http://d.puremagic.com/issues/show_bug.cgi?id=512
Summary: Assigning to constants in a forwarded constructor
doesn't work
Product: D
Version: 0.174
Platform: PC
URL: http://www.digitalmars.com/d/attribute.html
OS/Version: Windows
Status: NEW
Keywords: rejects-valid, spec
Severity: normal
Priority: P4
Component: DMD
AssignedTo: bugzilla digitalmars.com
ReportedBy: deewiant gmail.com
OtherBugsDependingO 511
nThis:
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".
--
Nov 15 2006
http://d.puremagic.com/issues/show_bug.cgi?id=512
deewiant gmail.com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |DUPLICATE
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 ***
--
Apr 21 2007








d-bugmail puremagic.com