[Issue 4173] Regression(2.037) Explicitly instantiated templates still try to do IFTI in some cases
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Sep 3 01:45:22 PDT 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4173
--- Comment #3 from Don <clugdbug at yahoo.com.au> 2010-09-03 01:45:03 PDT ---
It seems to be just luck that this ever worked at all. Template parameter
deduction has never worked for base classes or interfaces of a class. So
although this particular case used to work, it was very fragile -- very closely
related cases would fail.
I've only been able to fix this by implementing template parameter deduction
for base classes. It allows them as a "match with implicit conversion".
Thus, it also fixes bug 1715 "Template specialization checks for equality
rather than convertibility" and bug 1970 "Templated interfaces not matched".
But I've found a very annoying case:
interface I(X) {}
class C: I!(char), I!(double) {}
void foo(T)(I!(T) x) {}
void main()
{
C c = new C;
foo(c); // could match with I!char or I!double
}
This should be treated as a match-with-implicit-conversion for c, but the type
T has not been determined, so template instantiation should fail.
If the signature is instead: foo(T)(I!(T) x, T y){} and called with foo(c,
1.2), then instantiation should succeed.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list