digitalmars.D.bugs - [Issue 22915] New: Errors for invalid foreach aggregates should
- d-bugmail puremagic.com (30/30) Mar 23 2022 https://issues.dlang.org/show_bug.cgi?id=22915
https://issues.dlang.org/show_bug.cgi?id=22915 Issue ID: 22915 Summary: Errors for invalid foreach aggregates should print the type Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: minor Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: moonlightsentinel disroot.org The error message for `foreach` over unusupported types print a rather unhelpful error message that only lists (parts of) the expression. But it isn't always obvious, why the expression doesn't yield an iterable value, e.g.: struct S { int opApply(scope int delegate(const int) dg); } S* someFunc(); void foo() { foreach (const i; someFunc()) // Pointer to S, needs dereference { // ... } } --
Mar 23 2022