[Issue 2229] ICE(template.c) instantiating an invalid variadic template with more than one argument
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Sep 12 11:50:03 PDT 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2229
Don <clugdbug at yahoo.com.au> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |patch
--- Comment #10 from Don <clugdbug at 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: -------
More information about the Digitalmars-d-bugs
mailing list