diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2023-09-05 08:20:01 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2023-09-06 09:54:34 +0200 |
commit | 1fabac91e548fdb537dce25b3b9a58235275804c (patch) | |
tree | 404b35aadb37372dd52c6b355152099ae6b99c09 /sources/shiboken6/generator/shiboken/cppgenerator.cpp | |
parent | 4685aca4fc09db54b21814c7e70b62d4689bdccb (diff) |
Fix default parameters for containers without indirections
e48b696ffab552785d38d72dff6c9dda796c9628 disabled default parameters
for containers since indirections of the argument type can cause
clashes. Enable it for the case of no indirections.
Fixes: PYSIDE-2454
Pick-to: 6.5
Change-Id: Ie23b2e90244d7fe9e52e31c8314d51293fdbd8fa
Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'sources/shiboken6/generator/shiboken/cppgenerator.cpp')
-rw-r--r-- | sources/shiboken6/generator/shiboken/cppgenerator.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sources/shiboken6/generator/shiboken/cppgenerator.cpp b/sources/shiboken6/generator/shiboken/cppgenerator.cpp index 5155d121e..7866a702a 100644 --- a/sources/shiboken6/generator/shiboken/cppgenerator.cpp +++ b/sources/shiboken6/generator/shiboken/cppgenerator.cpp @@ -2891,7 +2891,7 @@ qsizetype CppGenerator::writePythonToCppTypeConversion(TextStream &s, // conversion for &cppOut s << ' ' << cppOutAux; // No default value for containers which can also be passed by pointer. - if (arg.type != GeneratorArgument::Type::Container) + if (arg.type != GeneratorArgument::Type::Container || type.indirections() == 0) writeMinimalConstructorExpression(s, api(), type, isPrimitive, defaultValue); s << ";\n" << typeName << " *" << cppOut << " = &" << cppOutAux; } @@ -2923,7 +2923,7 @@ qsizetype CppGenerator::writePythonToCppTypeConversion(TextStream &s, || arg.type == GeneratorArgument::Type::Enum || arg.type == GeneratorArgument::Type::Flags) { writeMinimalConstructorExpression(s, api(), typeEntry, isPrimitive, defaultValue); - } else if (!type.isContainer() && !type.isSmartPointer()) { + } else if ((!type.isContainer() || type.indirections() == 0) && !type.isSmartPointer()) { writeMinimalConstructorExpression(s, api(), type, isPrimitive, defaultValue); } break; |