Bug#890294: asymptote: complex eval-using code triggers assert failure
Package: asymptote
Version: 2.41-4
Severity: normal
Hello! Following piece of code is meant to create wrapper structures
around primitive types, simplifying creation of generic code.
var casts = quote {
public TWrap operator cast(TInner value)
{
var obj = new TWrap;
obj.value = value;
return obj;
}
public TInner operator cast(TWrap obj)
{
return obj.value;
}
};
void define_wrapper(string type)
{
string wrapper = 'A' + type;
string prog = 'public struct ' + wrapper + '{ ' + type + ' value; };';
eval(prog, true);
eval('typedef ' + wrapper + ' TWrap', true);
eval('typedef ' + type + ' TInner', true);
eval(casts, true);
}
define_wrapper('int');
define_wrapper('real');
Unfortunately, following error is produced instead:
asy: exp.cc:43: virtual void absyntax::exp::transAsType(trans::coenv&, types::ty*): Assertion `t->kind==ty_error || equivalent(t,target)' failed.
Problem is present in both versions in sid and stretch.
Reply to: