Bug 870 – contradictory error messages for templates

Status
RESOLVED
Resolution
FIXED
Severity
minor
Priority
P3
Component
dmd
Product
D
Version
D1 (retired)
Platform
All
OS
All
Creation time
2007-01-21T17:43:00Z
Last change time
2014-02-15T13:12:41Z
Keywords
diagnostic
Assigned to
bugzilla
Creator
thomas-dloop

Comments

Comment #0 by thomas-dloop — 2007-01-21T17:43:54Z
1 template Templ(alias a) { 2 void Templ(...) { 3 } 4 } 5 6 void main() { 7 int i; 8 Templ(i); 9 } a.d(8): template a.Templ(alias a) does not match any template declaration a.d(8): template a.Templ(alias a) cannot deduce template function from argument types (int) The two error messages are contradictory: 1) either there was no match and thus the second error messages is wrong 2) or the second message is correct(though doesn't mention line 2) and the first message is incorrect After rewriting the sample: 1 template Templ2(alias a) { 2 void Templ2(x) { 3 } 4 } 5 6 void main() { 7 int i; 8 Templ2(i); 9 } Error: identifier 'x' is not defined Error: x is used as a type a.d(8): template a.Templ2(alias a) does not match any template declaration a.d(8): template a.Templ2(alias a) cannot deduce template function from argument types (int) The first two messages are missing the location information.
Comment #1 by thomas-dloop — 2007-01-22T02:33:35Z
*** Bug 871 has been marked as a duplicate of this bug. ***
Comment #2 by bugzilla — 2008-06-27T12:55:49Z
The idea with multiple error messages is that the first one is correct, and any that follow should be viewed with suspicion because the compiler attempts to correct the error and move on. Of course, it can guess wrong about what is intended.
Comment #3 by bugzilla — 2008-07-09T22:42:25Z
Fixed dmd 2.016