[Issue 2810] Forward reference to an auto function

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue May 11 13:08:59 PDT 2010


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


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

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


--- Comment #6 from Rainer Schuetze <r.sagitario at gmx.de> 2010-05-11 13:08:56 PDT ---
I just stumbled over this issue, too. What needs to done is to infer the return
type of the function (calling semantic3 on the function at a rather early stage
of compilation). Here's the patch:

Index: expression.c
===================================================================
--- expression.c    (revision 483)
+++ expression.c    (working copy)
@@ -2448,6 +2448,9 @@

         if (!f->originalType && f->scope)       // semantic not yet run
             f->semantic(f->scope);
+        // if inferring return type, sematic3 needs to be run
+        if(f->inferRetType && f->type && !f->type->nextOf())
+            f->semantic3(f->scope);
         if (!f->type->deco)
         {
             error("forward reference to %s", toChars());

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