Compiler asserts instead of giving an error message with non-static struct initializers

Brad Roberts braddr at puremagic.com
Sun Oct 29 11:30:19 PST 2006


Max Bolingbroke wrote:
> Hi,
> 
> I have found that if you try and use static struct initialization syntax 
> on a struct variable you have not declared static you receive an 
> assertion failure in DMD and not a compiler error message as I would 
> expect. Test case and sample run below.
> 
> Thanks!
> 
> Max
> 
> -----------
> 
> struct Point
> {
>     int x;
>     int y;
> }
> 
> int main()
> {
>     Point point = { x : 1, y : 0 };    // Should be static
> 
>     return point.y;
> }
> 
> -------------
> 
> F:\Programming\Current>dmd testcase.d
> Assertion failure: '0' on line 219 in file 'init.c'
> 
> abnormal program termination

Yup.. see: http://d.puremagic.com/bugzilla/show_bug.cgi?id=378



More information about the Digitalmars-d-bugs mailing list