[Issue 102] Forward reference nested class wheel.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Oct 3 06:27:17 PDT 2009


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



--- Comment #11 from Rainer Schuetze <r.sagitario at gmx.de> 2009-10-03 06:27:15 PDT ---
(In reply to comment #8)
> IMHO this is a VERY promising patch since it potentially fixes many difficult
> issues. It's not quite complete though.
> I've run it though Walter's test suite, and one test fails (all others pass).
> The code below should fail to compile, but instead the compiler gets into an
> infinite loop --- it's an ice-on-invalid-code regression.
> 
> ----
> struct A (T) {
>        mixin B! (T, A! (T));
> }
> 
> A!(int) x;
> ----

I've been running into a similar problem with const initializers, that already
use a similar mechanism in DMD 2.032. If anonymous classes are involved, it
might freeze as well instead of producing an error. It took more time to
extract a sensible test case than to patch it, but here it is

module test;
class C
{
    const int a = (new class Object { int x; }).sizeof + y;
    S s;
}

struct S
{
    int s1;
}

"dmd -c test.d" causes dmd to freeze, instead of reporting "undefined identifer
y".

And this is the additional patch (line number might be skewed a little):

Index: declaration.c
===================================================================
--- declaration.c    (revision 196)
+++ declaration.c    (working copy)
@@ -1106,6 +1155,7 @@

         if (!global.errors && !inferred)
         {
+        unsigned progress = Module::dprogress;
         unsigned errors = global.errors;
         global.gag++;
         //printf("+gag\n");
@@ -1127,6 +1177,7 @@
         //printf("-gag\n");
         if (errors != global.errors)    // if errors happened
         {
+            Module::dprogress = progress; // we are throwing away the
expression copy, so no progress
             if (global.gag == 0)
             global.errors = errors;    // act as if nothing happened
 #if DMDV2

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