Three legitimate bugs? (D1.061)

Stewart Gordon smjg_1998 at yahoo.com
Sat May 29 07:00:19 PDT 2010


strtr wrote:
> Should I report these bugs?

The general answer to this question is: Yes, as long as
* you're sure it's a bug
* you can reproduce it in a current version of DMD or GDC
* it isn't already reported

The bug reporting system is here:
http://d.puremagic.com/issues/

> (and how should I call this first one?)
<snip>
> --
> main.d(4): Error: struct main.S no size yet for forward reference
> main.d(4): Error: struct main.S no size yet for forward reference
> main.d(11): Error: cannot evaluate opCall() at compile time
> ----

Puzzling.  It appears that line 2 is somehow helping the compiler to get 
it right - and without it, the compiler gets thrown while trying to make 
sense of the S() you're setting S2 to.  But the line numbers you're 
getting are puzzling in any case.

In any case, there's certainly a bug here.

<snip>
> --
> run main.exe
> Error: ArrayBoundsError main.d(8)
> should be t_def.d(8)
> ----

That's certainly a bug that needs to be reported if it isn't reported 
already.

> ----
> module main;
> 
> const S S1 = S();
> 
> struct S
> {
>   static S func( S s_ )
>   out(result){ assert(false,random); }
>   body{ return s_; }
> 
>   const S S2 = func(S());
> }
> void main(){}
> --
> main.d(8): Error: __error <---# should be assert failure #

The error should be "undefined identifier random".

> main.d(11): Error: cannot evaluate func((S())) at compile time

Indeed, this is probably a bug along the same lines as the compiler's 
tendency to treat invalid expressions as being subsequently of type int.

Stewart.


More information about the Digitalmars-d-learn mailing list