Bug 6728 – Better error message with map!{...}()

Status
RESOLVED
Resolution
WONTFIX
Severity
enhancement
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2011-09-25T11:06:00Z
Last change time
2016-10-15T01:02:17Z
Keywords
bootcamp, diagnostic
Assigned to
nobody
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2011-09-25T11:06:22Z
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.