http://d.puremagic.com/issues/show_bug.cgi?id=4090
Summary: foreach(const ref x; a) error message Product: D Version: future Platform: x86 OS/Version: Windows Status: NEW Keywords: diagnostic Severity: normal Priority: P2 Component: DMD AssignedTo: nob...@puremagic.com ReportedBy: bearophile_h...@eml.cc --- Comment #0 from bearophile_h...@eml.cc 2010-04-14 07:44:09 PDT --- This is a D2 program: void main() { double[10] arr; double tot = 0; foreach (const ref x; arr) tot += x; } dmd 2.043 prints: test.d(4): basic type expected, not ref test.d(4): no identifier for declarator const(int) test.d(4): found 'ref' when expecting ';' test.d(4): found ';' when expecting ')' test.d(4): found ')' when expecting ';' following 'statement' Those error messages are too many, and they don't describe what the problem is. Replacing the foreach line with the following line there are no compile errors: foreach (ref const(double) x; arr) Also note this program compiles with no errors: void foo(const ref int x) {} void main() {} -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------