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


Shin Fujishiro <rsi...@gmail.com> changed:

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


--- Comment #3 from Shin Fujishiro <rsi...@gmail.com> 2010-11-02 22:11:39 PDT 
---
Patch against dmd r737.

--- src/template.c
+++ src/template.c
@@ -4304,11 +4304,7 @@ TemplateDeclaration
*TemplateInstance::findTemplateDeclaration(Scope *sc)
         if (s->parent &&
             (ti = s->parent->isTemplateInstance()) != NULL)
         {
-            if (
-                (ti->name == id ||
-                 ti->toAlias()->ident == id)
-                &&
-                ti->tempdecl)
+            if (ti->tempdecl && ti->tempdecl->ident == id)
             {
                 /* This is so that one can refer to the enclosing
                  * template, even if it has the same name as a member


Getting 'ti' for recognizing recursion is good; but the identifier should be
compared with the one of a TemplateDeclaration, not the TemplateInstance.  As
happened in the reported bug, ti->name is not always the appropriate identifier
for recursion check.

The patch removes ti->toAlias() for good.  TemplateInstance::toAlias() does
*not* resolve alias of itself; as seen in its implementation, it actually
returns the "result" of the template and makes no sense.  'id' has to be
compared with ti->tempdecl->ident.

The patch passed dmd, druntime and phobos tests.  It couldn't pass the broken
test (runnable/interpret.d) though.

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

Reply via email to