www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4364] New: ICE compiling a struct def named 'Object' followed by a class definition

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: pjlbyrne gmail.com


--- Comment #0 from Patrick Byrne <pjlbyrne 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: -------
Jun 22 2010
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4364


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |clugdbug yahoo.com.au


--- Comment #1 from Don <clugdbug yahoo.com.au> 2010-09-27 13:35:10 PDT ---
Root cause (no patch yet): The special cases for class names need to be moved
from the class constructor, into the aggregate constructor.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 27 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4364


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |alienballance gmail.com


--- Comment #2 from Don <clugdbug yahoo.com.au> 2011-06-23 00:55:38 PDT ---
*** Issue 6016 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 23 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4364


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull
           Platform|x86                         |All
         OS/Version|Windows                     |All
           Severity|normal                      |major


--- Comment #3 from Kenji Hara <k.hara.pg gmail.com> 2012-06-01 04:51:32 PDT ---
https://github.com/D-Programming-Language/dmd/pull/974

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 01 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4364



--- Comment #4 from github-bugzilla puremagic.com 2012-06-12 15:58:47 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/fbe7a1c9e107c9eb4bba8f27c87f248b7e6889ae
fix Issue 4364 - ICE(class.c) compiling a struct def named 'Object' followed by
a class definition

Stop looking for 'Object' type.

https://github.com/D-Programming-Language/dmd/commit/1c618b0b1eeee336e442767037cf86a103446765
Merge pull request #974 from 9rnsr/fix4364

Issue 4364 - ICE(class.c) compiling a struct def named 'Object' followed by a
class definition

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 12 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4364


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |FIXED


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 12 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4364



--- Comment #5 from Patrick Byrne <pjlbyrne gmail.com> 2012-06-13 02:35:09 PDT
---
Thanks!

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