From f6e8ba7e9861e29dbd995d984accc79e96a10388 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 21 Sep 2021 11:36:03 +0200 Subject: shiboken6: Fix an invalid static_cast The argument type is not necessarily a PrimitiveTypeEntry. Task-number: PYSIDE-1660 Pick-to: 6.1 5.15 Change-Id: I312f20e24cfe888d10c218db596d29c3ab318bd6 Reviewed-by: Cristian Maureira-Fredes Reviewed-by: Christian Tismer --- sources/shiboken6/generator/shiboken/cppgenerator.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sources/shiboken6/generator/shiboken/cppgenerator.cpp b/sources/shiboken6/generator/shiboken/cppgenerator.cpp index 3a8f2c2a2..43a2b4e78 100644 --- a/sources/shiboken6/generator/shiboken/cppgenerator.cpp +++ b/sources/shiboken6/generator/shiboken/cppgenerator.cpp @@ -1094,7 +1094,7 @@ void CppGenerator::writeVirtualMethodNative(TextStream &s, continue; const auto &argType = arg.type(); - auto argTypeEntry = static_cast(argType.typeEntry()); + const auto *argTypeEntry = argType.typeEntry(); bool convert = argTypeEntry->isObject() || argTypeEntry->isValue() || argType.isValuePointer() @@ -1105,9 +1105,10 @@ void CppGenerator::writeVirtualMethodNative(TextStream &s, || argType.referenceType() == LValueReference; if (!convert && argTypeEntry->isPrimitive()) { - if (argTypeEntry->basicReferencedTypeEntry()) - argTypeEntry = argTypeEntry->basicReferencedTypeEntry(); - convert = !formatUnits().contains(argTypeEntry->name()); + const auto *pte = static_cast(argTypeEntry); + if (pte->basicReferencedTypeEntry()) + pte = pte->basicReferencedTypeEntry(); + convert = !formatUnits().contains(pte->name()); } StringStream ac(TextStream::Language::Cpp); -- cgit v1.2.3