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
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.