Thread overview
[Issue 3818] New: Generic error message for wrong foreach
Jan 20, 2013
Andrej Mitrovic
February 18, 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@puremagic.com
        ReportedBy: bearophile_hugs@eml.cc


--- Comment #0 from bearophile_hugs@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: -------
July 30, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3818



--- Comment #1 from bearophile_hugs@eml.cc 2010-07-30 15:00:41 PDT ---
See bug 4537 too.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 20, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=3818


Andrej Mitrovic <andrej.mitrovich@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tomeksowi@gmail.com


--- Comment #2 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-01-20 13:27:13 PST ---
*** Issue 4537 has been marked as a duplicate of this issue. ***

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