[Issue 4364] New: ICE compiling a struct def named 'Object' followed by a class definition

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jun 22 02:30:57 PDT 2010


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

           Summary: ICE compiling a struct def named 'Object' followed by
                    a class definition
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: pjlbyrne at gmail.com


--- Comment #0 from Patrick Byrne <pjlbyrne at gmail.com> 2010-06-22 02:30:54 PDT ---
This source file crashes the compiler for me:
--------------------------
struct Object{} 
class Game {} 
--------------------------
..using dmd2 / windows / VisualD / VS2010Int

Changing 'Object' to any other string makes the crash go away.
Removing the second line ("class Game {}") makes the crash go away.

The assert is:
Assertion failure: 'b->type->ty == Tclass' on line 449 in file 'class.c'

In 'class.c' in the src directory (C:\dmd\src), the assert appears to be on
line 446.
Function:
  void ClassDeclaration::semantic(Scope *sc)
Code:
// If no base class, and this is not an Object, use Object as base class
if (!baseClass && ident != Id::Object)
{
// BUG: what if Object is redefined in an inner scope?
Type *tbase = new TypeIdentifier(0, Id::Object);
BaseClass *b;
TypeClass *tc;
Type *bt;

if (!object)
{
    error("missing or corrupt object.d");
    fatal();
}
bt = tbase->semantic(loc, sc)->toBasetype();
b = new BaseClass(bt, PROTpublic);
baseclasses.shift(b);
assert(b->type->ty == Tclass); **** LINE 446 ****
tc = (TypeClass *)(b->type);
baseClass = tc->sym;
assert(!baseClass->isInterfaceDeclaration());
b->base = baseClass;
}

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