www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - Enum is Forward Referenced

reply John Reimer <brk_6502 yahoo.com> writes:
I guess enums can't be forward referenced like other symbols in D?

This does not work:

module enumtest;

# struct Foo
# {
#	TEST X;
# }
#
# enum TEST { A, B, C }

Though doing this is, perhaps, unnecessary, it doesn't seem to be 
consistant with what D is supposed to be able to do.

Quoted here:

"Names at the global level can be forward referenced without needing a 
special declaration:"

  -- http://www.digitalmars.com/d/sdwest/paper.html

Perhaps this forward referencing flexibility applies only to functions, 
structs, and classes?

Curious.

-- John
Dec 11 2004
parent Thomas Kuehne <thomas-dloop kuehne.thisisspam.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Added to DStress as
http://svn.kuehne.cn/dstress/run/enum_10.d
http://svn.kuehne.cn/dstress/run/enum_11.d

Thomas

John Reimer schrieb am Sat, 11 Dec 2004 15:26:00 -0800:
 I guess enums can't be forward referenced like other symbols in D?

 This does not work:

 module enumtest;

 # struct Foo
 # {
 #	TEST X;
 # }
 #
 # enum TEST { A, B, C }

 Though doing this is, perhaps, unnecessary, it doesn't seem to be 
 consistant with what D is supposed to be able to do.

 Quoted here:

 "Names at the global level can be forward referenced without needing a 
 special declaration:"

   -- http://www.digitalmars.com/d/sdwest/paper.html

 Perhaps this forward referencing flexibility applies only to functions, 
 structs, and classes?

 Curious.

 -- John

-----BEGIN PGP SIGNATURE----- iD4DBQFBvM+l3w+/yD4P9tIRAi5aAJj7/bG3Fecy+jN1dKFSVT8PjpYUAKC1OUdE ww8hUFd/9ljcrNU0wfd1uw== =2t+j -----END PGP SIGNATURE-----
Dec 12 2004