www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - Compiler assertion failure with any module *.object

reply Chris Sauls <ibisbasenji gmail.com> writes:
Given the following source files:

##### main.d
# module main;
#
# private import lib.object;
#
# void main () {
#   MyObject o = new MyObject;
# }

##### lib/object.d
# module lib.object;
#
# public class MyObject : Object {
# }

One gets this output from DMD 0.141, using command line "build main" :
lib\object.d(3): identifier 'Object' is not defined
lib\object.d(3): Object is used as a type
lib\object.d(3): class lib.object.MyObject base type must be class or
interface, not void
lib\object.d(3): identifier 'Object' is not defined
lib\object.d(3): Object is used as a type
Assertion failure: 'b->type->ty == Tclass' on line 284 in file 'class.c'

abnormal program termination

In this particular project it'd be no big deal to rename the trouble module to just 'obj' instead of 'object.' However, it still shouldn't be causing the specific problems the compiler appears to be experiencing. -- Chris Sauls
Dec 24 2005
parent "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
"Chris Sauls" <ibisbasenji gmail.com> wrote in message 
news:dojatn$98v$1 digitaldaemon.com...
 Given the following source files:

 ##### main.d
 # module main;
 #
 # private import lib.object;
 #
 # void main () {
 #   MyObject o = new MyObject;
 # }

 ##### lib/object.d
 # module lib.object;
 #
 # public class MyObject : Object {
 # }

 One gets this output from DMD 0.141, using command line "build main" :
lib\object.d(3): identifier 'Object' is not defined
lib\object.d(3): Object is used as a type
lib\object.d(3): class lib.object.MyObject base type must be class or 
interface, not void
lib\object.d(3): identifier 'Object' is not defined
lib\object.d(3): Object is used as a type
Assertion failure: 'b->type->ty == Tclass' on line 284 in file 'class.c'

abnormal program termination

In this particular project it'd be no big deal to rename the trouble module to just 'obj' instead of 'object.' However, it still shouldn't be causing the specific problems the compiler appears to be experiencing. -- Chris Sauls

I think the compiler thinks you're trying to replace the internal object.d with your own object.d. Kind of odd, and maybe the compiler could be made more intelligent and know only to use the object.d in the phobos directory.
Dec 24 2005