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


Rainer Schuetze <r.sagita...@gmx.de> changed:

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


--- Comment #1 from Rainer Schuetze <r.sagita...@gmx.de> 2010-01-05 00:36:08 
PST ---
The error occurs when dmd tries to match the overloaded member function to the
functions in the base class, but hits the slightly different prototype. It then
tries to check the return type for covariance, which fails on the forward
referenced class.

here's a patch (or maybe just a workaround as I'm not perfectly sure what this
does to erronous declarations), but it also fixes the problem, if the return
type is actually a forward referenced covariant class.

Index: func.c
===================================================================
--- func.c    (revision 324)
+++ func.c    (working copy)
@@ -510,9 +510,20 @@
             /* Only need to have a tintro if the vptr
              * offsets differ
              */
+            unsigned errors = global.errors;
+            global.gag++;            // suppress printing of error messages
             int offset;
-            if (fdv->type->nextOf()->isBaseOf(type->nextOf(), &offset))
+            int baseOf = fdv->type->nextOf()->isBaseOf(type->nextOf(),
&offset);
+            global.gag--;            // suppress printing of error messages
+            if(errors != global.errors)
             {
+                // any error in isBaseOf() is a forward reference error, so we
bail out
+                global.errors = errors;
+                cd->sizeok = 2;    // can't finish due to forward reference
+                return;
+            }
+            if (baseOf)
+            {
                 ti = fdv->type;
 #if 0
                 if (offset)

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

Reply via email to