digitalmars.D.bugs - [Issue 7211] New: Initializing const members in derived classes' constructors
- d-bugmail puremagic.com (33/33) Jan 03 2012 http://d.puremagic.com/issues/show_bug.cgi?id=7211
http://d.puremagic.com/issues/show_bug.cgi?id=7211 Summary: Initializing const members in derived classes' constructors Product: D Version: D2 Platform: All OS/Version: All Status: NEW Keywords: rejects-valid Severity: normal Priority: P3 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: thecybershadow gmail.com --- Comment #0 from Vladimir Panteleev <thecybershadow gmail.com> 2012-01-03 11:39:16 PST --- I believe this code is valid: class C { immutable int x; } class D : C { this() { x = 42; } } Compiler complains: test.d(10): Error: can only initialize const member x inside constructor Even if this code is invalid, the error message is misleading in this case. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 03 2012