Error serializing big class in DMD 2.064
jmcabo opened this issue · 7 comments
Hello!!
When compiling with DMD 2.064, I can use orange with simple classes, but not with the complex class. Errors show up when compiling.
When using DMD 2.062, I can serialize the same class without problems.
I still couldn't reduce the problem to a small test case, but I thought I'd paste the errors anyways:
J:\sdk\orange\dsss_imports\orange\core\Attribute.di(62): Error: struct orange.core.Attribute.Attributes!(1).Attributes failed semantic analysis
J:\sdk\orange\dsss_imports\orange\core\Attribute.di(57): Error: template instance orange.core.Attribute.Attributes!(1) error instantiating
J:\sdk\orange\dsss_imports\orange\serialization\Serializer.di(1841): instantiated from here: getAttributes!(1)
J:\sdk\orange\dsss_imports\orange\serialization\Serializer.di(1854): instantiated from here: triggertUdaEvent!(onSerializing, const(MyComplexClass))
J:\sdk\orange\dsss_imports\orange\serialization\Serializer.di(772): instantiated from here: triggerEvents!(const(MyComplexClass))
J:\sdk\orange\dsss_imports\orange\serialization\Serializer.di(718): ... (17 instantiations, -v to show) ...
J:\sdk\orange\dsss_imports\orange\serialization\Serializer.di(665): instantiated from here: serializeInternal!(ProgramStateInfo)
J:\MyProject\ProgramState.d(108): instantiated from here: serialize!(ProgramStateInfo)
J:\sdk\orange\dsss_imports\orange\serialization\Serializer.di(1841): Error: template instance orange.core.Attribute.getAttributes!(1) error instantiating
J:\sdk\orange\dsss_imports\orange\serialization\Serializer.di(1854): instantiated from here: triggertUdaEvent!(onSerializing, const(MyComplexClass))
J:\sdk\orange\dsss_imports\orange\serialization\Serializer.di(772): instantiated from here: triggerEvents!(const(MyComplexClass))
J:\sdk\orange\dsss_imports\orange\serialization\Serializer.di(718): instantiated from here: serializeObject!(const(MyComplexClass))
J:\sdk\orange\dsss_imports\orange\serialization\Serializer.di(924): ... (16 instantiations, -v to show) ...
J:\sdk\orange\dsss_imports\orange\serialization\Serializer.di(665): instantiated from here: serializeInternal!(ProgramStateInfo)
J:\MyProject\ProgramState.d(108): instantiated from here: serialize!(ProgramStateInfo)
--jm
How large test case do you have? What about 2.063.2 and 2.064.2, have you tried any of those?
I'll try 2.063.2 later today.
And I'm sorry, when I said 2.064 I meant 2.064.2.
--jm
I managed to reduce it to this:
class TwoConsts {
public const static int FIRST = 1;
public const static int SECOND = 1;
public bool someFlag;
}
Please note that if I comment one of the two constants, the errors go away.
The same happens with:
class TwoConsts {
public immutable FIRST = 1;
public immutable SECOND = 1;
public bool someFlag;
}
--jm
Ok, thanks, I'll look into it.
Just to clarify, you're trying to serialize an instance of TwoConsts
?
Just to clarify, you're trying to serialize an instance of TwoConsts?
Yes, which is inside another class, ProgramStateInfo. As in:
class ProgramStateInfo {
[...]
TwoConsts obj;
[...]
}
//And then, somewhere else:
serializer.serialize(programStateInfo);
Thanks for looking into this!!
--jm
I just tested with 2.063.2, and it is worse. It prints an error and then DMD crashes:
Assertion failure: 'type->ty != Tstruct || ((TypeStruct *)type)->sym == this' on line 741 in file 'struct.c'
and a message box is displayed, saying:
abnormal program termination
If I comment one of the two constants, DMD 2.063.2 compiles just fine. If the two constants equal 1 are present, it crashes.
--jm