Bug 1193 – regression: "matches more than one template declaration" doesn't list the location of the conflicting templates

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P3
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
All
Creation time
2007-04-27T12:57:00Z
Last change time
2014-02-16T15:23:31Z
Keywords
diagnostic, patch
Assigned to
nobody
Creator
thomas-dloop

Comments

Comment #0 by thomas-dloop — 2007-04-27T12:57:45Z
# template fn( T ) { # void fn() { # } # } # # template fn( T ) { # void fn( T val ) { # } # } # # void main() { # mixin fn!(int); # } DMD-1.010: nocompile/t/template_25_A.d(18): template dstress.nocompile.t.template_25_A.fn(T) conflicts with dstress.nocompile.t.template_25_A.fn(T) at nocompile/t/template_25_A.d(13) DMD-1.013: nocompile/t/template_25_A.d(24): mixin fn!(int) matches more than one template declaration, fn(T) and fn(T) test cases: http://dstress.kuehne.cn/nocompile/t/template_25_A.d http://dstress.kuehne.cn/nocompile/t/template_class_17.d http://dstress.kuehne.cn/nocompile/t/template_struct_07.d
Comment #1 by braddr — 2010-05-19T00:00:25Z
quick easy fix for this one (against dmd 2.x, but likely applies easily enough to 1.x): diff --git a/src/template.c b/src/template.c --- a/src/template.c +++ b/src/template.c @@ -4313,8 +4313,10 @@ TemplateDeclaration *TemplateInstance::findBestMatch(Scope *sc) } if (td_ambig) { - error("%s matches more than one template declaration, %s and %s", - toChars(), td_best->toChars(), td_ambig->toChars()); + error("%s matches more than one template declaration, %s(%d):%s and %s(%d):%s", + toChars(), + td_best->loc.filename, td_best->loc.linnum, td_best->toChars(), + td_ambig->loc.filename, td_ambig->loc.linnum, td_ambig->toChars()); } /* The best match is td_best Results in: bug1193.d(12): Error: mixin fn!(int) matches more than one template declaration, bug1193.d(1):fn(T) and bug1193.d(6):fn(T)
Comment #2 by bugzilla — 2010-06-02T00:49:58Z