[Issue 15351] New: foreach by ref accepted, although front returns by value
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Tue Nov 17 03:32:02 PST 2015
https://issues.dlang.org/show_bug.cgi?id=15351
Issue ID: 15351
Summary: foreach by ref accepted, although front returns by
value
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Severity: minor
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: schuetzm at gmx.net
This compiles, but IMO shouldn't, because S.front doesn't return by ref:
struct S {
@property int front() { return 0; }
@property bool empty() { return false; }
void popFront() { }
}
void main() {
foreach(ref i; S()) { }
}
--
More information about the Digitalmars-d-bugs
mailing list