[Issue 22820] New: Error messages for slice pointers of structs with opIndex can be improved
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Feb 23 11:32:49 UTC 2022
https://issues.dlang.org/show_bug.cgi?id=22820
Issue ID: 22820
Summary: Error messages for slice pointers of structs with
opIndex can be improved
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: enhancement
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: contact at lsferreira.net
Error messages for slice pointers without bounds can be improved to show an
hint to the programmer to explicit dereference the pointer to access opIndex,
e.g.:
struct Atum {
int[] opIndex() {
return a;
}
int[] a;
}
int main() {
Atum* atum = new Atum;
writeln(atum[].ptr);
}
Should produce something like:
Error: need upper and lower bound to slice pointer, perhaps you meant
`(*atum)[]`
--
More information about the Digitalmars-d-bugs
mailing list