Don <> changed:

           What    |Removed                     |Added
           Keywords|                            |patch, rejects-valid

--- Comment #4 from Don <> 2010-09-01 11:57:33 PDT ---
This bug was triggered by svn commit 273, which was related to opDispatch.
The immediate change was in CallExp::semantic(). Previously, it attempted full
explicit instantiation, and if that failed, it tried partial explicit
instantiation. In this case, the full explicit instantiation was failing
(because there were two candidate templates), and then partial instantiation
After svn 273, it calls needsTypeInference(). If that returns true, it does
partial instantiation, otherwise does full instantiation. In this example, it's
returning false.

There is a situation missing from needsTypeInference(). If there is more than
one candidate template, and they are ALL function templates, and they are ALL 
potentially explicitly instantiated, we need to do partial instantiation.

Template.c, needsTypeInference(), around line 4625.

Index: template.c
--- template.c    (revision 655)
+++ template.c    (working copy)
@@ -4622,6 +4622,7 @@
     //printf("TemplateInstance::needsTypeInference() %s\n", toChars());
     if (!tempdecl)
         tempdecl = findTemplateDeclaration(sc);
+    int multipleMatches = FALSE;
     for (TemplateDeclaration *td = tempdecl; td; td = td->overnext)
         /* If any of the overloaded template declarations need inference,
@@ -4647,9 +4648,14 @@
         if (Parameter::dim(fdtype->parameters) &&
             (tp || tiargs->dim < td->parameters->dim))
             return TRUE;
+        /* If there is more than one function template which matches, we may
need type inference
+         */
+        if (td != tempdecl)
+            multipleMatches = TRUE;
-    return FALSE;
+    return multipleMatches;

 void TemplateInstance::semantic2(Scope *sc)

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to