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