diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2021-09-21 11:36:03 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2021-09-21 20:40:54 +0200 |
commit | 86f66dfd8bc6834f0f43fb5e34369ad33ec47711 (patch) | |
tree | 9c89a67dad1d9f96cc051caed4112b03247b8cde /sources | |
parent | e837e10ba5bd9ca617ef7cf9ce9d7263f9c275b1 (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)
Diffstat (limited to 'sources')
-rw-r--r-- | sources/shiboken2/generator/shiboken2/cppgenerator.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp index 9303caacf..eb9199292 100644 --- a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp +++ b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp @@ -1054,7 +1054,7 @@ void CppGenerator::writeVirtualMethodNative(QTextStream &s, QString argConv; QTextStream ac(&argConv); - auto argType = static_cast<const PrimitiveTypeEntry *>(arg->type()->typeEntry()); + const auto *argType = arg->type()->typeEntry(); bool convert = argType->isObject() || argType->isValue() || arg->type()->isValuePointer() @@ -1063,11 +1063,11 @@ void CppGenerator::writeVirtualMethodNative(QTextStream &s, || argType->isEnum() || argType->isContainer() || arg->type()->referenceType() == LValueReference; - if (!convert && argType->isPrimitive()) { - if (argType->basicReferencedTypeEntry()) - argType = argType->basicReferencedTypeEntry(); - convert = !m_formatUnits.contains(argType->name()); + const auto *pte = static_cast<const PrimitiveTypeEntry *>(argType); + if (pte->basicReferencedTypeEntry()) + pte = pte->basicReferencedTypeEntry(); + convert = !m_formatUnits.contains(pte->name()); } Indentor nested; |