diff options
author | Hugo Lima <hugo.lima@openbossa.org> | 2010-03-22 11:36:23 -0300 |
---|---|---|
committer | Hugo Lima <hugo.lima@openbossa.org> | 2010-03-22 16:01:37 -0300 |
commit | 4ffdd19f47f5f159cae856695d9528b23ce62eae (patch) | |
tree | 9930f035f0f3f9e91e4ad30f53dcb251b1cd53da /cppgenerator.cpp | |
parent | d96d5df9b8d3f5caaa66a7f75f2f8fe1a1395159 (diff) |
Fix CppGenerator::writeMinimalConstructorCallArguments when the class has non-primitive
types with default values.
Reviewer: Bruno Araújo <bruno.araujo@openbossa.org>
Reviewer: Anderson Lizardo <anderson.lizardo@openbossa.org>
Diffstat (limited to 'cppgenerator.cpp')
-rw-r--r-- | cppgenerator.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/cppgenerator.cpp b/cppgenerator.cpp index e8590413a..d9cd0bf46 100644 --- a/cppgenerator.cpp +++ b/cppgenerator.cpp @@ -748,7 +748,7 @@ void CppGenerator::writeMinimalConstructorCallArguments(QTextStream& s, const Ab bool allPrimitives = true; foreach (const AbstractMetaArgument* arg, candidate->arguments()) { - if (!arg->type()->isPrimitive()) { + if (!arg->type()->isPrimitive() && arg->defaultValueExpression().isEmpty()) { allPrimitives = false; break; } @@ -766,8 +766,10 @@ void CppGenerator::writeMinimalConstructorCallArguments(QTextStream& s, const Ab QStringList argValues; AbstractMetaArgumentList args = ctor->arguments(); - for (int i = 0; i < args.size(); i++) - argValues << args[i]->type()->name()+"(0)"; + for (int i = 0; i < args.size(); i++) { + if (args[i]->defaultValueExpression().isEmpty()) + argValues << args[i]->type()->name()+"(0)"; + } s << metaClass->qualifiedCppName() << '(' << argValues.join(QLatin1String(", ")) << ')'; } |