digitalmars.D.bugs - [Issue 10643] New: Refused const array struct field initialized with void
- d-bugmail puremagic.com (30/30) Jul 14 2013 http://d.puremagic.com/issues/show_bug.cgi?id=10643
- d-bugmail puremagic.com (19/19) Jul 14 2013 http://d.puremagic.com/issues/show_bug.cgi?id=10643
http://d.puremagic.com/issues/show_bug.cgi?id=10643 Summary: Refused const array struct field initialized with void Product: D Version: D2 Platform: x86 OS/Version: Windows Status: NEW Keywords: rejects-valid Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: bearophile_hugs eml.cc class Bar { const int[1000] x = void; this(int n) { x[] = n; } } void main() {} dmd 2.064alpha gives errors but I think the code is correct: test.d(2): Warning: const field with initializer should be static, __gshared, or an enum test.d(4): Error: slice x[] is not mutable There is also some discussion in this thread: http://forum.dlang.org/thread/laxoykycmqqggbfqvobm forum.dlang.org -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 14 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10643 Maxim Fomin <maxim maxim-fomin.ru> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |maxim maxim-fomin.ru --- From http://dlang.org/changelog.html#staticfields : "Eventually, they will be deprecated, and then will trigger an error." The issue is that void initializer does not disable initialization but fills aggregate member with zero (it also fills data with zeros for types which .init property is not zero). If you replace void with some number, the code would not still compile, so this is not a specific to void. Also this fails in accordance with change-log. I think this can be change to request to make void behavior to what it does for local variables or request to update the spec, but in current circumstances this issue is resolved-invalid. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 14 2013