aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken6/generator/shiboken/cppgenerator.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'sources/shiboken6/generator/shiboken/cppgenerator.cpp')
-rw-r--r--sources/shiboken6/generator/shiboken/cppgenerator.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/sources/shiboken6/generator/shiboken/cppgenerator.cpp b/sources/shiboken6/generator/shiboken/cppgenerator.cpp
index aacbd8240..7f8158128 100644
--- a/sources/shiboken6/generator/shiboken/cppgenerator.cpp
+++ b/sources/shiboken6/generator/shiboken/cppgenerator.cpp
@@ -304,6 +304,17 @@ QList<AbstractMetaFunctionCList>
AbstractMetaFunctionCPtr CppGenerator::boolCast(const AbstractMetaClass *metaClass) const
{
const auto *te = metaClass->typeEntry();
+ if (te->isSmartPointer()) {
+ auto *ste = static_cast<const SmartPointerTypeEntry *>(te);
+ auto nullCheckMethod = ste->nullCheckMethod();
+ if (!nullCheckMethod.isEmpty()) {
+ const auto func = metaClass->findFunction(nullCheckMethod);
+ if (func.isNull())
+ throw Exception(msgMethodNotFound(metaClass, nullCheckMethod));
+ return func;
+ }
+ }
+
auto mode = te->operatorBoolMode();
if (useOperatorBoolAsNbNonZero()
? mode != TypeSystem::BoolCast::Disabled : mode == TypeSystem::BoolCast::Enabled) {