[Issue 9252] New: Wrong error message in a case of alias-this-array indexing with double value
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Jan 1 08:53:02 PST 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9252
Summary: Wrong error message in a case of alias-this-array
indexing with double value
Product: D
Version: D2
Platform: x86
OS/Version: Windows
Status: NEW
Keywords: diagnostic
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: bearophile_hugs at eml.cc
--- Comment #0 from bearophile_hugs at eml.cc 2013-01-01 08:53:01 PST ---
This program shows a correct error message:
void main() {
int[5] a;
double i = 0;
a[i] = 0;
}
test.d(4): Error: cannot implicitly convert expression (i) of type double to
uint
While this code in a similar case shows a not good error message:
struct Foo {
int[] data = [0];
alias this = data;
}
void main() {
Foo a;
int i1 = 0;
a[i1] = 10; // OK.
assert(a.data[0] == 10);
double i2 = 0;
a[i2] = 20; // Error.
}
DMD 2.061alpha gives:
test.d(11): Error: no [] operator overload for type Foo
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list