Bug 5905 – Error message with const fixed-size array
Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2011-04-28T15:14:00Z
Last change time
2012-12-27T21:09:36Z
Keywords
rejects-valid
Assigned to
nobody
Creator
bearophile_hugs
Comments
Comment #0 by bearophile_hugs — 2011-04-28T15:14:07Z
D2 code:
void main() {
const float[1] a;
const(float[1]) b;
const(float)[1] c;
}
DMD 2.052 shows the compile error messages:
test.d(2): Error: slice a[] is not mutable
test.d(3): Error: slice b[] is not mutable
test.d(4): Error: slice c[] is not mutable
I think such error messages are not clear enough.
Comment #1 by kennytm — 2011-04-29T11:42:15Z
What do you suggest? "Missing value for a constant fixed array"?
Comment #2 by bearophile_hugs — 2011-05-02T04:15:38Z
(In reply to comment #1)
> What do you suggest? "Missing value for a constant fixed array"?
This sounds better than the current error message.
Noted: currently this code is accepted:
struct Foo {}
void main() {
const(Foo) f;
}
f is initialized to a const .init.
Comment #3 by andrej.mitrovich — 2012-12-27T17:57:46Z