File tree Expand file tree Collapse file tree 1 file changed +16
-3
lines changed Expand file tree Collapse file tree 1 file changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -917,9 +917,22 @@ if (!is(S : T) &&
917
917
auto result = ()@trusted { return cast (T) value; }();
918
918
if (! result && value)
919
919
{
920
- throw new ConvException(" Cannot convert object of static type "
921
- ~ S.classinfo.name~ " and dynamic type " ~ value.classinfo.name
922
- ~ " to type " ~ T.classinfo.name);
920
+ string name (TypeInfo ti) @trusted
921
+ {
922
+ while (auto tc = (cast (TypeInfo_Const) ti))
923
+ {
924
+ ti = tc.base;
925
+ }
926
+ if (auto tinf = (cast (TypeInfo_Interface ) ti))
927
+ {
928
+ ti = tinf.info;
929
+ }
930
+ TypeInfo_Class tc = cast (TypeInfo_Class ) ti;
931
+ assert (tc);
932
+ return tc.name;
933
+ }
934
+ throw new ConvException(" Cannot convert object of static type " ~
935
+ name(typeid (S)) ~ " and dynamic type " ~ name(typeid (value)) ~ " to type " ~ name(typeid (T)));
923
936
}
924
937
return result;
925
938
}
You can’t perform that action at this time.
0 commit comments