From b00e0c6b56a2b0543dffcbdca951ce59b16fa5ef 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 Change-Id: I312f20e24cfe888d10c218db596d29c3ab318bd6 Reviewed-by: Cristian Maureira-Fredes Reviewed-by: Christian Tismer (cherry picked from commit f6e8ba7e9861e29dbd995d984accc79e96a10388) Reviewed-by: Qt Cherry-pick Bot --- 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 6a3cb0fe9..b892d9392 100644 --- a/sources/shiboken6/generator/shiboken/cppgenerator.cpp +++ b/sources/shiboken6/generator/shiboken/cppgenerator.cpp @@ -1088,7 +1088,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() @@ -1099,9 +1099,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