Bug 717 – toobj.c:191: virtual void ClassDeclaration::toObjFile(): Assertion `!scope' failed.

Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Linux
Creation time
2006-12-22T07:25:00Z
Last change time
2014-02-15T13:19:17Z
Keywords
diagnostic, ice-on-invalid-code
Assigned to
bugzilla
Creator
thomas-dloop
Blocks
723

Comments

Comment #0 by thomas-dloop — 2006-12-22T07:25:02Z
(Originally posted by bobef <[email protected]> on 2006-03-01 as news:[email protected]) # # 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
Comment #1 by smjg — 2007-09-18T15:49:03Z
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.
Comment #2 by bugzilla — 2007-10-30T23:02:52Z
Gives decent error message, no seg fault, with dmd 1.022 and 2.006.