[Issue 3600] template instantiation with empty tuple

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Dec 29 04:12:07 PST 2009


http://d.puremagic.com/issues/show_bug.cgi?id=3600


Rainer Schuetze <r.sagitario at gmx.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch
                 CC|                            |r.sagitario at gmx.de


--- Comment #1 from Rainer Schuetze <r.sagitario at gmx.de> 2009-12-29 04:12:05 PST ---
I don't know why this worked before and could not see a change that caused the
regression from version 2.036, but here is a patch that adds an empty type
tuple to the deduced template parameters if it has not yet been created and
does not show up in the function parameters:

Index: template.c
===================================================================
--- template.c    (revision 317)
+++ template.c    (working copy)
@@ -1142,6 +1142,13 @@

     /* Fill in any missing arguments with their defaults.
      */
+    if(tp && fptupindex < 0 && nargsi == dedargs->dim - 1)
+    { // for variadic type parameters not in function parameters, allow empty
tuple
+        Tuple *t = new Tuple();
+        dedargs->data[dedargs->dim - 1] = (void *)t;
+        nargsi++; 
+    }
+
     for (i = nargsi; i < dedargs->dim; i++)
     {
     TemplateParameter *tp = (TemplateParameter *)parameters->data[i];

-- 
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