Thread overview
Assertion failure: 'fieldi>=0 && fieldi < se->elements->dim' on line 2062 in file 'interpret.c'
May 07, 2010
strtr
May 07, 2010
strtr
May 07, 2010
Don
May 13, 2010
strtr
May 14, 2010
bearophile
May 14, 2010
strtr
May 14, 2010
strtr
May 07, 2010
Killed it again :(

May 07, 2010
Not feeding a float to ToString! seems to bring it back to life.

What is up with that anyway?
How do I output a float in compile time?
May 07, 2010
strtr wrote:
> Killed it again :(
> 

Are you using the latest DMD? If so, please try to create a test case, as this bug has never been reported before. Thanks!
May 13, 2010
Don Wrote:

> strtr wrote:
> > Killed it again :(
> >
>
> Are you using the latest DMD?
I was/am using 1.060

> If so, please try to create a test case,
> as this bug has never been reported before. Thanks!

Had to put some time into actual coding..
but I just tried to create a test case:
Removed the few dependencies of the fixed problem module and tried to compile it
by importing it in a clean main module. It didn't compile, which led me to this
tiny version which still doesn't compile :

----
module main;
import s_def;
void main(){}
----
module s_def;
struct S
{
  float area;

  static S opCall( float a_ )
  {
    S s = { a_ };
    return s;
  }

  const S _s = S( 1f );
}
----

s_def.d(3): Error: struct s_def.S no size yet for forward reference
I don't know what this means

s_def.d(12): Error: cannot evaluate opCall(1F) at compile time
Probably related.

As far as I know I do exactly the same in my program
After understanding this I'll try to recreate the ToString!() bug :)
May 14, 2010
This produces the same errors:


struct Foo {
    int bar;
    static Foo baz() {
        return Foo();
    }
    const Foo one = Foo.baz();
}
void main() {}


Bye,
bearophile
May 14, 2010
== Quote from bearophile (bearophileHUGS@lycos.com)'s article
> This produces the same errors:
> struct Foo {
>     int bar;
>     static Foo baz() {
>         return Foo();
>     }
>     const Foo one = Foo.baz();
> }
> void main() {}
> Bye,
> bearophile

And this is why in my program compiled anyways :

----
module main;

import s_def;

void main(){}
----
module s_def;

import e_def; // <---this

struct S
{
  float area;
  static S opCall( float a_ )
  {
    S s = { a_ };
    return s;
  }
  const S _s = S( 1f );
}
----
module e_def;

import s_def;

const S e = S(1f);
----

I have import problems quite regularly, but I always fail at tinifying them :)



May 14, 2010
or :

module main;
//const S s = S(.5f); // Uncomment to make it compile
struct S
{
  float a;
  static S opCall( float a_ )
  {
    S s = { a_ };
    return s;
  }
  const S _s = S( 1f );
}
void main(){}