I'm trying to update to 2.35.1 from a previous release, and a significant number of ternary operators in existing scripts are now broken. There's no way to rewrite the scripts, which have accumulated over a period of years. Is this intentional behavior, and if so, is there a setting somewhere (using asIScriptEngine::SetEngineProperty or similar) I can toggle to undo it?
Here are some trivial examples that no longer compile, instead citing “Can't find unambiguous implicit conversion to make both expressions have the same type.” It seems to me it should be unambiguous that the types are supposed to be converted to int
:
int a = true ? 1 : 1.;
int a = true ? 1 : uint(1);
int a = true ? 1 : int16(1);
Similarly, this previously-fine code now fails with the errors “No default constructor for object of type 'foo'” and “No appropriate opAssign method found in 'foo' for value assignment."
class foo {
foo(int){}
}
void main() {
foo@ bar = true ? foo(0) : foo(0);
}
Without the ternary operator, i.e. foo@ bar = foo(0);
, it compiles normally.