diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2017-11-24 16:22:45 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2017-11-24 17:50:19 +0000 |
commit | 909efeedaf05ab9e3a5e8cd805efd9d58ba7a198 (patch) | |
tree | a89b2580d9fd8dc34e4973850885585641bdbff4 /sources/shiboken2/generator | |
parent | 7108de44da71aaf0511be543f1b21a6c38b86b1e (diff) |
shiboken: Do not generate richcompare methods for namespaces
shiboken used to generate richcompare methods for namespaces when
it contained free comparison operators for classes in that namespace,
resulting in compile errors. For example:
namespace Qt3DRender {
bool operator!=(const QGraphicsApiFilter &reference, const QGraphicsApiFilter &sample)
...
Add a check preventing that.
Task-number: PYSIDE-487
Change-Id: If2fa1de1bfb0fdc11c9415421dab0c7e13abc500
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'sources/shiboken2/generator')
-rw-r--r-- | sources/shiboken2/generator/shiboken2/cppgenerator.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp index a2b497132..8fbce8091 100644 --- a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp +++ b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp @@ -515,7 +515,7 @@ void CppGenerator::generateClass(QTextStream &s, GeneratorContext &classContext) writeMappingMethods(s, metaClass, classContext); } - if (metaClass->hasComparisonOperatorOverload()) { + if (!metaClass->isNamespace() && metaClass->hasComparisonOperatorOverload()) { s << "// Rich comparison" << endl; writeRichCompareFunction(s, classContext); } @@ -3670,7 +3670,7 @@ void CppGenerator::writeClassDefinition(QTextStream &s, } QString tp_richcompare = QString(QLatin1Char('0')); - if (metaClass->hasComparisonOperatorOverload()) + if (!metaClass->isNamespace() && metaClass->hasComparisonOperatorOverload()) tp_richcompare = cpythonBaseName(metaClass) + QLatin1String("_richcompare"); QString tp_getset = QString(QLatin1Char('0')); |