Skip to content

Commit a66c106

Browse files
remove uses of classinfo, rebases part of #7445
1 parent a51c0ea commit a66c106

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

std/conv.d

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -917,9 +917,22 @@ if (!is(S : T) &&
917917
auto result = ()@trusted{ return cast(T) value; }();
918918
if (!result && value)
919919
{
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+
static if (is(S == interface))
921+
{
922+
auto nameDyn = typeid(value).info.name;
923+
auto nameS = typeid(S).info.name;
924+
}
925+
else
926+
{
927+
auto nameDyn = typeid(value).info;
928+
auto nameS = typeid(S).info;
929+
}
930+
static if (is(T == interface))
931+
auto nameT = typeid(T).info.name;
932+
else
933+
auto nameT = typeid(T).name;
934+
throw new ConvException("Cannot convert object of static type " ~
935+
nameS ~ " and dynamic type " ~ nameDyn ~ " to type " ~ nameT);
923936
}
924937
return result;
925938
}

0 commit comments

Comments
 (0)