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

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 512 - Assigning to constants in a forwarded constructor doesn't work
Summary: Assigning to constants in a forwarded constructor doesn't work
Status: RESOLVED DUPLICATE of issue 789
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D1 (retired)
Hardware: x86 Windows
: P4 normal
Assignee: Walter Bright
URL: http://www.digitalmars.com/d/attribut...
Keywords: rejects-valid, spec
Depends on:
Blocks: 511
Show dependency tree / graph
Reported: 2006年11月15日 05:49 UTC by Matti Niemenmaa
Modified: 2014年02月15日 13:20 UTC (History)
0 users

See Also:


Attachments
Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this issue.
Description Matti Niemenmaa 2006年11月15日 05:49:56 UTC
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 Matti Niemenmaa 2007年04月21日 11:20:43 UTC
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 ***


AltStyle によって変換されたページ (->オリジナル) /