www.digitalmars.com         C & C++   DMDScript  

D - Static field in static struct using initializer: assertion failure

reply "Les Baker" <lesbaker innovaREMOVETHIS.net> writes:
Got another bug to report:

if a static field is used in a static declared struct, and the static
initializer syntax is used on that field, an assert results.

In other words, given:
struct Foobar
{
    static int foo;
}

int main(char[][] args)
{
    static Foobar fb = {foo : 123};
    return 0;
}

compiler says:
Assertion failure: 'fieldi < ad->fields.dim' on line 126 in file 'init.c'

abnormal program termination

Is static fields inside structs legal syntax anyway? The D docs don't have
much to say about it (talks about class and variable "static" usage).
Aug 19 2003
parent "Walter" <walter digitalmars.com> writes:
Yes, it's legal syntax and should work.
Aug 23 2003