Thread overview
[Issue 870] New: contradictory error messages for templates
Jan 21, 2007
d-bugmail
Jan 22, 2007
d-bugmail
Jun 27, 2008
d-bugmail
Jul 10, 2008
d-bugmail
Jun 09, 2009
Don
January 21, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=870

           Summary: contradictory error messages for templates
           Product: D
           Version: 1.00
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: minor
          Priority: P3
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: thomas-dloop@kuehne.cn


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.


-- 

January 22, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=870





------- Comment #1 from thomas-dloop@kuehne.cn  2007-01-22 02:33 -------
*** Bug 871 has been marked as a duplicate of this bug. ***


-- 

June 27, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=870





------- Comment #2 from bugzilla@digitalmars.com  2008-06-27 12:55 -------
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.


-- 

July 10, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=870





------- Comment #3 from bugzilla@digitalmars.com  2008-07-09 22:42 -------
Fixed dmd 2.016


-- 

June 09, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=870


Don <clugdbug@yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |clugdbug@yahoo.com.au
         Resolution|                            |FIXED




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