www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - Compiler asserts instead of giving an error message with non-static

reply Max Bolingbroke <"batterseapower{no" sp4/\\/\\}hotmail.com> writes:
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
Oct 29 2006
parent reply Brad Roberts <braddr puremagic.com> writes:
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
Oct 29 2006
parent Max Bolingbroke <"batterseapower{no" sp4/\\/\\}hotmail.com> writes:
Brad Roberts wrote:
 Yup.. see: http://d.puremagic.com/bugzilla/show_bug.cgi?id=378
Oops :) I didn't find that since I searched for "line 219", and of course the line number changes...
Oct 29 2006