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


Robert Clipsham <rob...@octarineparrot.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch
                 CC|                            |rob...@octarineparrot.com


--- Comment #1 from Robert Clipsham <rob...@octarineparrot.com> 2010-04-23 
20:50:46 BST ---
This is caused as default arguments to templates are only instantiated once,
which causes the Boo!T to always become whatever is instantiated first. The
patch below fixes this:
--- template.c       2010-03-18 18:58:06.000000000 +0000
+++ template.c  2010-04-23 20:49:54.000000000 +0100
@@ -2993,6 +2993,17 @@

 Object *TemplateAliasParameter::defaultArg(Loc loc, Scope *sc)
 {
+    Type *ta = isType(defaultAlias);
+    if (ta)
+    {
+       if (ta->ty == Tinstance)
+       {
+           // If the default arg is a template, instantiate for each type
+           Object *da = ta->syntaxCopy();
+           Object *o = aliasParameterSemantic(loc, sc, da);
+           return o;
+       }
+    }
     Object *o = aliasParameterSemantic(loc, sc, defaultAlias);
     return o;
 }

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

Reply via email to