www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 6728] New: Better error message with map!{...}()


           Summary: Better error message with map!{...}()
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: diagnostic
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc

--- Comment #0 from bearophile_hugs eml.cc 2011-09-25 11:06:22 PDT ---
A low-priority enhancement request.
This is wrong D2 code:

import std.algorithm;
void main() {
    auto r = map!{ a * a }([1, 2]);

DMD 2.056head gives four error messages:

test.d(3): template argument expected following !
test.d(3): semicolon expected following auto declaration, not '{'
test.d(3): found '}' when expecting ';' following statement
test.d(4): found 'EOF' when expecting '}' following compound statement

It contains a common mistake:

instead of:

Given how common such mistake is in my code, I'd like the compiler to recognize
it and show (if possible) a single and more readable error message.

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