Fix llvm9 not autoconverting int->double for variant
In llvm9 the following doesn't compile anymore:
struct S{};
std::variant<double, S> var{5};
This MR introduces additional check in the constructor and assignment operator of the Result
type, and will then try to force a conversion from the given type T2
to either the value type T
or the error type E
in case:
-
T
is not convertible toE
or vice versa -
T
is notE
-
T2
is not convertible toT
ANDE
at the same time
If this is the case, Result
will try to convert to T
if T2
is convertible to T
or E
if T2
is convertible to E
.