Bug 223 – Error message for unset constants doesn't specify error location

Status
RESOLVED
Resolution
FIXED
Severity
trivial
Priority
P3
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Windows
Creation time
2006-06-24T14:28:00Z
Last change time
2014-02-15T13:19:20Z
Keywords
diagnostic
Assigned to
bugzilla
Creator
matti.niemenmaa+dbugzilla

Comments

Comment #0 by matti.niemenmaa+dbugzilla — 2006-06-24T14:28:37Z
int i = void.init; The above code correctly produces the error "integral constant must be scalar type, not void". Alas, DMD neglects to inform where the error occurred: even when compiling a large project containing many long files, the error message is precisely the quoted string. Whilst not strictly speaking a bug, I believe this is enough of an issue that it merits fixing.
Comment #1 by smjg — 2006-09-10T12:29:52Z
What makes you think it's "not strictly speaking a bug"?
Comment #2 by matti.niemenmaa+dbugzilla — 2006-09-13T10:28:43Z
Poor wording, or a brain fart, on my part. It is a bug, but since the error is reported correctly it's not that big of a deal.
Comment #3 by lio+bugzilla — 2006-09-15T11:23:55Z
The same incomplete error is generated for the following code: void main() { const int x; } DMD v0.166: UnhandledError(0,0): Error: integral constant must be scalar type, not void
Comment #4 by thomas-dloop — 2006-09-20T14:20:54Z
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 [email protected] schrieb am 2006-09-15: > http://d.puremagic.com/issues/show_bug.cgi?id=223 > ------- Comment #3 from [email protected] 2006-09-15 11:23 ------- > The same incomplete error is generated for the following code: > > void main() > { > const int x; > } > > DMD v0.166: > UnhandledError(0,0): Error: integral constant must be scalar type, not void Added to DStress as http://dstress.kuehne.cn/nocompile/c/const_38_A.d http://dstress.kuehne.cn/nocompile/c/const_38_B.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFFEZt3LK5blCcjpWoRAsWlAKCZMsDwbbO6la3mAqc1LQtmU2BNdACdEguD QY9NRc/gJIQHFlN0isZPOLA= =kk1z -----END PGP SIGNATURE-----
Comment #5 by braddr — 2007-10-20T03:37:33Z
The noise past the original bug report seems to have gotten the original bug overlooked. void main() { int i == void.init; } Produces this error, without a line number for the second error: bug223.d(3): Error: void does not have an initializer Error: integral constant must be scalar type, not void. NOTE: dropping the .init part changes the semantics to 'don't default initialize i' and there's no error at all, which is the correct behavior.
Comment #6 by clugdbug — 2008-06-19T07:22:41Z
This works now (DMD 1.030 & 2.015).