www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - -831 is not an expression

reply Brian Hjøllund <Brian_member pathlink.com> writes:
I've discovered what I consider to be a bug.
I used the search functionality provided by the site to see if any other posts
had been made about it, and I was unable to find any. If I missed it, I
apologize for this redundant post.
Anyway, this throws the above error:

const int RBN_FIRST = -831;

Apparently, I'm not allowed to assign negative values to a const variable. Is
this a bug, or by design? If so, why?

/Brian
Jan 10 2005
parent reply Thomas Kuehne <thomas-dloop kuehne.thisisspam.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Brian Hjøllund wrote:
 Anyway, this throws the above error:
 
 const int RBN_FIRST = -831;
I can remember seeing that error message in a similar situation. The problem is that the line alone doesn't throw the message. (Linux dmd-110/gdc-0.10) Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFB43Pj3w+/yD4P9tIRAmD7AJ9cygnSm3vSkzIndh4t1rs2KIM6mACgxhYw Shjkqxj085A+JUqCibftEQ0= =T2jx -----END PGP SIGNATURE-----
Jan 10 2005
parent reply Brian Hjøllund <Brian_member pathlink.com> writes:
The problem is that the line alone doesn't throw the message.
You're right, I just tried it on it's own. So I trimmed the source a bit, and finally came up with the following: int main() { return 0; } const int RBN_FIRST = -831; enum { RBN_HEIGHTCHANGE = RBN_FIRST } I'm using DMD 0.110 on Windows XP SP2, Danish edition /Brian
Jan 11 2005
parent Thomas Kuehne <thomas-dloop kuehne.thisisspam.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Added to DStress as 
http://dstress.kuehne.cn/compile/const_12.d
http://dstress.kuehne.cn/compile/const_13.d

Thomas


-----BEGIN PGP SIGNATURE-----

iD8DBQFB4/9I3w+/yD4P9tIRAgCeAKCAvH9uaEjIuRb+hx7GyUQkVghaCgCghikv
ZTgRqafY+4a8MAjePxXrd1A=
=6Mx3
-----END PGP SIGNATURE-----
Jan 11 2005