Bug 452 – Struct initialization fails with compiler assertion
Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Windows
Creation time
2006-10-24T13:17:00Z
Last change time
2014-02-15T13:20:55Z
Keywords
ice-on-invalid-code
Assigned to
bugzilla
Creator
wbaxter
Comments
Comment #0 by wbaxter — 2006-10-24T13:17:01Z
The code snippet below gives me a compiler error with DMD 0.172.
| > dmd atest.d
| Assertion failure: '0' on line 219 in file 'init.c'
| abnormal program termination
------------atest.d------------
struct Foo
{
int a;
int b;
}
void main()
{
Foo x = {1,2};
}
I take it I'm not allowed to use initializers except for 'static' variables, so it's a mistake in my code. Still that shouldn't cause a runtime assertion in the compiler. A proper error like "initialization of non-static struct not allowed" would be more useful.
Comment #1 by braddr — 2006-10-24T14:10:17Z
*** This bug has been marked as a duplicate of 378 ***