Thread overview
interpret.c assertion failure on enum.stringof mixin
Feb 07, 2010
strtr
Feb 08, 2010
strtr
Feb 08, 2010
strtr
Feb 08, 2010
Don
Feb 08, 2010
strtr
February 07, 2010
enum { E };
void _mixin() {
	writefln( E.stringof );
}
void func() {
	mixin(_mixin);
}
Assertion failure: '!dim || (parameters && (parameters->dim == dim))' on line 140 in file 'interpret.c'

At least I got a line number this time :)
February 08, 2010
strtr Wrote:

> enum { E };
> void _mixin() {
> 	writefln( E.stringof );
> }
> void func() {
> 	mixin(_mixin);
> }
> Assertion failure: '!dim || (parameters && (parameters->dim == dim))' on line 140 in file 'interpret.c'
> 
> At least I got a line number this time :)

Had nothing to do with the enum :)

void _mixin() {
	writefln( "" );
}
void func() {
	mixin(_mixin);
}
February 08, 2010
strtr Wrote:

> strtr Wrote:
> 
> > enum { E };
> > void _mixin() {
> > 	writefln( E.stringof );
> > }
> > void func() {
> > 	mixin(_mixin);
> > }
> > Assertion failure: '!dim || (parameters && (parameters->dim == dim))' on line 140 in file 'interpret.c'
> > 
> > At least I got a line number this time :)
> 
> Had nothing to do with the enum :)
> 
> void _mixin() {
> 	writefln( "" );
> }
> void func() {
> 	mixin(_mixin);
> }

mixins seem te choke on errors :(

enum E { A = 0, B, C }
char[] _mixin() {
return format( "s = ", (cast(E)1).stringof, ";" );
}
void func() {
char[] s;
mixin ( _mixin() );
}
Same assertion failure.

Anyways, how do I get the string "E.A" out of the int 0 ?

February 08, 2010
strtr wrote:
> strtr Wrote:
> 
>> enum { E };
>> void _mixin() {
>> 	writefln( E.stringof );
>> }
>> void func() {
>> 	mixin(_mixin);
>> }
>> Assertion failure: '!dim || (parameters && (parameters->dim == dim))' on line 140 in file 'interpret.c'
>>
>> At least I got a line number this time :)

Wow, seems like you and the compiler are at war...

> Had nothing to do with the enum :)
> 
> void _mixin() {
> 	writefln( "" );
> }
> void func() {
> 	mixin(_mixin);
> }

Please put this into bugzilla. Title "ICE(interpret.c): mixin non-CTFE function" or similar.
February 08, 2010
Don Wrote:

> Wow, seems like you and the compiler are at war...
> 
I had an even more horrid dmd crash some time ago, removing a circular selective import seemed to fix it. But I'm not sure and can't replicate it any more :(

> 
> Please put this into bugzilla. Title "ICE(interpret.c): mixin non-CTFE function" or similar.
Done.
Ah, ICE = Internal Compiler Error :)
And, format isn't a CTFE-function?

Could you maybe also help me with this one?

enum E { A = 0, B, C }
char[] _mixin(int i) {
  return "e = " ~ (cast(E)i).stringof ~ ";";
}
void main() {
  E e;
  mixin( _mixin(1) );
}
// Error: type E is not an expression

I just want to use a var to index an enum and then get its .stringof :)