Bug 12678 – Field constness missing in diagnostics for multiple field initialization error

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-04-29T00:27:00Z
Last change time
2014-04-29T12:23:57Z
Keywords
diagnostic, pull
Assigned to
andrej.mitrovich
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2014-04-29T00:27:53Z
const struct Foo { int field; int Field; this(int x) { Field = x; Field = x; foreach (i; 0 .. 5) field = x; } } void main() {} Gives with DMD 2.066alpha: temp.d(6,9): Error: multiple field Field initialization temp.d(8,13): Error: field field initializing not allowed in loops or after labels But I think something similar to this is better: temp.d(6,9): Error: multiple const 'Field' initialization is not allowed temp.d(8,13): Error: const 'field' initialization isn't allowed in loops or after labels
Comment #1 by andrej.mitrovich — 2014-04-29T09:04:39Z
Comment #2 by github-bugzilla — 2014-04-29T12:23:56Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/ac4679e9e9fd39ddb50fe287223c0927824caff2 Fix Issue 12678 - Field constness missing in diagnostics for multiple field initialization error. https://github.com/D-Programming-Language/dmd/commit/4bf0ca19418057c7ec8b9c5fee85246e4e3b5f03 Merge pull request #3511 from AndrejMitrovic/Fix12678 Issue 12678 - Field constness missing in diagnostics for multiple field initialization error.