[Issue 4543] New: typedef circular definition and ICE

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Aug 1 04:10:59 PDT 2010


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

           Summary: typedef circular definition and ICE
           Product: D
           Version: D1
          Platform: All
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: ibuclaw at ubuntu.com


--- Comment #0 from Iain Buclaw <ibuclaw at ubuntu.com> 2010-08-01 04:10:55 PDT ---
In DMD 1.049, this code used to work:

--
bug01a.d
----------
module bug01a;
import bug01b;
union any {}
typedef any ANY;

--
bug01b.d
-----------
module bug01b;
import bug01a;
struct circular_definition {
    union {
        ANY subany;
    }
}

Later (not sure when, but have tested on DMD 1.059) - this code began failing
with the message:

bug01a.d(4): Error: typedef bug01a.ANY circular definition


Now - this code fails and ICE's the compiler:

bug01a.d(4): Error: typedef bug01a.ANY circular definition
Segmentation fault


Other things to note about the bug, swapping the typedef and union declaration
in bug01a.d works

--
bug02a.d
----------
module bug02a;
import bug02b;
typedef any ANY;
union any {}


However, adding another struct in the second module triggers it again

--
bug02b.d
----------
module bug02b;
import bug02a;
struct circular_definition {
    union {
        ANY subany;
    }
}
struct triggers_bug {}


And ultimately, putting the import at the bottom means it compiles successfully
all the time.

--
works01a.d
----------
module works01a;
typedef any ANY;
union any {}
import works01b;


Regards

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