www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Assertion failure: 'fieldi>=0 && fieldi < se->elements->dim' on line 2062 in file 'interpret.c'

reply strtr <strtr spam.com> writes:
Killed it again :(
May 07 2010
next sibling parent strtr <strtr spam.com> writes:
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
prev sibling parent reply Don <nospam nospam.com> writes:
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 07 2010
parent reply strtr <strtr spam.com> writes:
Don Wrote:

 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!

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 13 2010
parent reply bearophile <bearophileHUGS lycos.com> writes:
This produces the same errors:


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


Bye,
bearophile
May 13 2010
parent reply strtr <strtr spam.com> writes:
== 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
parent strtr <strtr spam.com> writes:
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(){}
May 14 2010