[Issue 1698] New: foreach auto type inference doesnt work properly
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Nov 29 05:03:13 PST 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1698
Summary: foreach auto type inference doesnt work properly
Product: D
Version: 2.008
Platform: PC
OS/Version: Windows
Status: NEW
Keywords: rejects-valid
Severity: normal
Priority: P2
Component: DMD
AssignedTo: bugzilla at digitalmars.com
ReportedBy: spam at extrawurst.org
since the const/invariant changes in dmd2.008 the following valid code wont
compile anymore, cause the compile is not able to infer the type for c
correctly i think.
[CODE]
void bar(ref char c) {
}
void main() {
string text;
foreach(ref c; text) { // adding type char makes it work
bar(c);
}
}
[\CODE]
compiler message:
Error: cast(char)c is not an lvalue
--
More information about the Digitalmars-d-bugs
mailing list