[Issue 3818] New: Generic error message for wrong foreach

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Feb 18 10:18:34 PST 2010


http://d.puremagic.com/issues/show_bug.cgi?id=3818

           Summary: Generic error message for wrong foreach
           Product: D
           Version: 2.040
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2010-02-18 10:18:34 PST ---
void main() {
    auto a = [10];
    foreach(i, x, a) {}
}


This common programming mistake produces this error message:

test.d(3): no identifier for declarator a

But it's better if dmd here prints a better error message, specific for
foreach(), to help programmers.

(I think this typing mistake is sometimes caused because inside a foreach a
comma sometimes looks quite similar to a semicolon.)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list