[Issue 190] Cannot forward reference typedef/alias in default value for function parameter

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jul 20 14:07:20 PDT 2010


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


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

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


--- Comment #3 from Rainer Schuetze <r.sagitario at gmx.de> 2010-07-20 14:07:12 PDT ---
The problem of the original test case is the default initializer. It is
evaluated when the type of the function is inferred, but the referenced
variable has not yet been semantically analyzed.

Here's a patch:

Index: expression.c
===================================================================
--- expression.c    (revision 576)
+++ expression.c    (working copy)
@@ -4350,6 +4350,8 @@
         }
 #endif
     }
+    if(type && !type->deco)
+        type = type->semantic(loc, sc);

     /* Fix for 1161 doesn't work because it causes protection
      * problems when instantiating imported templates passing private
@@ -6046,7 +6048,8 @@
                         e->type = v->type;
                     }
                 }
-                return e->deref();
+                e = e->deref();
+                return e->semantic(sc);
             }

             FuncDeclaration *f = s->isFuncDeclaration();


The test case in comment 2 is something different and compiles with DMD 2.047.

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