Thread overview
[Issue 717] New: toobj.c:191: virtual void ClassDeclaration::toObjFile(): Assertion `!scope' failed.
Dec 22, 2006
d-bugmail
Sep 18, 2007
d-bugmail
Oct 31, 2007
d-bugmail
December 22, 2006
http://d.puremagic.com/issues/show_bug.cgi?id=717

           Summary: toobj.c:191: virtual void ClassDeclaration::toObjFile():
                    Assertion `!scope' failed.
           Product: D
           Version: 0.177
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: thomas-dloop@kuehne.cn


(Originally posted by bobef <bobef@lessequal.com> on 2006-03-01 as news:du4ojh$1b0n$1@digitaldaemon.com)

#
# template T(){
#    class A : B{
#    }
#
#    class B : A{
#    }
# }
#
# void main(){
#    mixin T!();
# }
#

and

#
# template T(){
#    class B : A{
#    }
#
#    class A{
#    }
# }
#
# void main(){
#    mixin T!();
# }
#

cause the compiler message:
toobj.c:195: virtual void ClassDeclaration::toObjFile(): Assertion `!scope'
failed

test cases: http://dstress.kuehne.cn/nocompile/c/class_22_C.d http://dstress.kuehne.cn/nocompile/c/class_22_E.d


-- 

September 18, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=717


smjg@iname.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |smjg@iname.com
           Keywords|                            |diagnostic, ice-on-invalid-
                   |                            |code




------- Comment #1 from smjg@iname.com  2007-09-18 15:49 -------
Please remember to assign keywords to bug reports.  To everybody reading this: Please look through issues you've reported and check for missing keywords.

As I try it in DMD 1.020 (Windows), I don't get a crash, but these error
messages:

bz717a.d(2): class bz717a.main.T!().A has forward references
bz717a.d(4): class bz717a.main.T!().B has forward references

bz717b.d(2): class bz717b.main.T!().B has forward references

If I put the classes into main directly....
----------
void main(){
    class B : A{
    }
    class A{
    }
}
----------
bz717c.d(2): Error: identifier 'A' is not defined
bz717c.d(2): Error: A is used as a type
bz717c.d(2): class bz717c.main.B base type must be class or interface, not void
----------

I'm not sure if your second testcase and mine should be legal.  It's in the spec (unless it's changed since I looked) that nested functions can't forward-reference each other, but I'm not sure if this applies to classes within functions as well.


-- 

October 31, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=717


bugzilla@digitalmars.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WORKSFORME




------- Comment #2 from bugzilla@digitalmars.com  2007-10-30 23:02 -------
Gives decent error message, no seg fault, with dmd 1.022 and 2.006.


--