aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2021-09-21 11:36:03 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-09-21 14:51:46 +0000
commitb00e0c6b56a2b0543dffcbdca951ce59b16fa5ef (patch)
treea9ae16d494ddaf294e4f862efdf44cb17a89a1f1
parent2b1b38d5c70af838d40129289deadbd97beeef54 (diff)
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 <cristian.maureira-fredes@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com> (cherry picked from commit f6e8ba7e9861e29dbd995d984accc79e96a10388) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--sources/shiboken6/generator/shiboken/cppgenerator.cpp9
1 files 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<const PrimitiveTypeEntry *>(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<const PrimitiveTypeEntry *>(argTypeEntry);
+ if (pte->basicReferencedTypeEntry())
+ pte = pte->basicReferencedTypeEntry();
+ convert = !formatUnits().contains(pte->name());
}
StringStream ac(TextStream::Language::Cpp);