D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 6728 - Better error message with map!{...}()
Summary: Better error message with map!{...}()
Status: RESOLVED WONTFIX
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86 Windows
: P2 enhancement
Assignee: No Owner
URL:
Keywords: bootcamp, diagnostic
Depends on:
Blocks:
 
Reported: 2011-09-25 11:06 UTC by bearophile_hugs
Modified: 2016-10-15 01:02 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description bearophile_hugs 2011-09-25 11:06:22 UTC
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:
map!{...}()

instead of:
map!q{...}()

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.