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

--- Comment #0 from Patrick Byrne <> 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.
  void ClassDeclaration::semantic(Scope *sc)
// 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");
bt = tbase->semantic(loc, sc)->toBasetype();
b = new BaseClass(bt, PROTpublic);
assert(b->type->ty == Tclass); **** LINE 446 ****
tc = (TypeClass *)(b->type);
baseClass = tc->sym;
b->base = baseClass;

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to