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


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch


--- Comment #10 from Don <clugd...@yahoo.com.au> 2009-09-12 11:50:02 PDT ---
This is actually really simple. 
ROOT CAUSE: The D1 logic in template.c,
TemplateDeclaration::deduceFunctionTemplateMatch() is completely wrong.
if (nargsi > parameters->dim) && tp, the assert in the for loop will definitely
fail.
PATCH (around line 797 of template.c):
==========
   if (targsi)
    {    // Set initial template arguments

    nargsi = targsi->dim;
+    size_t argsToUse = nargsi;
    if (nargsi > parameters->dim)
    {   if (!tp)
        goto Lnomatch;
        dedargs->setDim(nargsi);
        dedargs->zero();
+        argsToUse = parameters->dim;
    }

    memcpy(dedargs->data, targsi->data, nargsi * sizeof(*dedargs->data));

-    for (size_t i = 0; i < nargsi; i++)
+    for (size_t i = 0; i < argsToUse; i++)
    {   assert(i < parameters->dim);

This patch also fixes bug 1897.

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

Reply via email to