[Issue 452] New: Struct initialization fails with compiler assertion

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Oct 24 11:17:08 PDT 2006


http://d.puremagic.com/issues/show_bug.cgi?id=452

           Summary: Struct initialization fails with compiler assertion
           Product: D
           Version: 0.172
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: wbaxter at gmail.com


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.


-- 




More information about the Digitalmars-d-bugs mailing list