www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - Assertion failure: mtype.c 3020 (among other things) - forward referencing

reply Stewart Gordon <smjg_1998 yahoo.com> writes:
Using DMD 0.110, Windows 98SE.

----------
class Qwert {
     YUIOP asdfg;
}

enum YUIOP { HJKL, ZXCVB, NM }
----------
enum YUIOP is forward referenced
enum YUIOP is forward referenced
D:\My Documents\Programming\D\Tests\bugs\enum_forward.d(1): enum YUIOP 
is forward referenced
Assertion failure: 'sym->memtype' on line 3020 in file 'mtype.c'
----------

It seems to vary whether the compiler hangs, crashes with an illegal 
operation or just exits 'normally' having given me this.

The assertion failure seems to happen only if it's used in a class, 
struct or union.  The following uses of the forward-referenced enum 
simply give an error "enum YUIOP is forward referenced" without crashing 
the compiler:

- global variable
- return type of global/member function
- parameter of global/member function
- alias or typedef of such a function

Firstly, this is yet another error that's missing its filename and line 
number; secondly, it ought to work.  (I guess the long-term goal is to 
eradicate the words "forward referenced" from DMD's repertoire of errors?)

These uses give no error at all:

- local variable, whether static or not
- return or parameter type of function nested within a function
- alias or typedef of the enum itself (though trying to use the 
alias/typedef before the original enum has been declared triggers the 
same bugs)
- using one of the enum values
- apparently anything at all if the enum has an underlying type specified

Stewart.

-- 
My e-mail is valid but not my primary mailbox.  Please keep replies on 
the 'group where everyone may benefit.
Jan 12 2005
parent Thomas Kuehne <thomas-dloop kuehne.thisisspam.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Added to DStress as 
http://dstress.kuehne.cn/run/forward_reference_07.d
http://dstress.kuehne.cn/run/forward_reference_08.d
http://dstress.kuehne.cn/run/forward_reference_09.d
http://dstress.kuehne.cn/run/forward_reference_10.d
http://dstress.kuehne.cn/run/forward_reference_11.d

Thomas

Stewart Gordon schrieb am Wed, 12 Jan 2005 10:11:09 +0000:
 Using DMD 0.110, Windows 98SE.

 ----------
 class Qwert {
      YUIOP asdfg;
 }

 enum YUIOP { HJKL, ZXCVB, NM }
 ----------
 enum YUIOP is forward referenced
 enum YUIOP is forward referenced
 D:\My Documents\Programming\D\Tests\bugs\enum_forward.d(1): enum YUIOP 
 is forward referenced
 Assertion failure: 'sym->memtype' on line 3020 in file 'mtype.c'
 ----------

 It seems to vary whether the compiler hangs, crashes with an illegal 
 operation or just exits 'normally' having given me this.

 The assertion failure seems to happen only if it's used in a class, 
 struct or union.  The following uses of the forward-referenced enum 
 simply give an error "enum YUIOP is forward referenced" without crashing 
 the compiler:

 - global variable
 - return type of global/member function
 - parameter of global/member function
 - alias or typedef of such a function

 Firstly, this is yet another error that's missing its filename and line 
 number; secondly, it ought to work.  (I guess the long-term goal is to 
 eradicate the words "forward referenced" from DMD's repertoire of errors?)

 These uses give no error at all:

 - local variable, whether static or not
 - return or parameter type of function nested within a function
 - alias or typedef of the enum itself (though trying to use the 
 alias/typedef before the original enum has been declared triggers the 
 same bugs)
 - using one of the enum values
 - apparently anything at all if the enum has an underlying type specified

 Stewart.
-----BEGIN PGP SIGNATURE----- iD8DBQFB5Skq3w+/yD4P9tIRAqKMAKDKDVudJFBMYmXlOykoYEimBEnVEgCffF46 UokjPBjrBKO7L0gRLlZn/30= =JhNf -----END PGP SIGNATURE-----
Jan 12 2005