digitalmars.D.bugs - [Issue 11741] New: Fields with void initializers cannot be cooked in constructors
- d-bugmail puremagic.com (38/38) Dec 14 2013 https://d.puremagic.com/issues/show_bug.cgi?id=11741
- d-bugmail puremagic.com (13/15) Dec 14 2013 https://d.puremagic.com/issues/show_bug.cgi?id=11741
https://d.puremagic.com/issues/show_bug.cgi?id=11741 Summary: Fields with void initializers cannot be cooked in constructors Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: jakobovrum gmail.com --- Example exhibiting the problem: --- class S { immutable int a = void; this() { a = 42; } } --- Error output: --- test.d(7): Error: cannot modify immutable expression a --- It compiles and works as expected without the void initializer. It's understandable behaviour for non-void initializers, but I think the void initializer should be treated as a special case; fields with void initializers should be considered uncooked in the constructor. The example might seem frivolous, but it's important when the field is a fixed-length array, for which void initializers can make a big difference. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 14 2013
https://d.puremagic.com/issues/show_bug.cgi?id=11741 Jakob Ovrum <jakobovrum gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |DUPLICATE ---Example exhibiting the problem: ...*** This issue has been marked as a duplicate of issue 10643 *** -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 14 2013