aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2017-02-23 13:16:16 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2017-02-23 15:32:48 +0000
commita45049999520f3981c83964db4ae81c8123e48ee (patch)
treeadde73273413c92b61330fd8942a4026d3338ba1
parent379afa410925616e9c116a3d9c2fa4832f9ce4e2 (diff)
traverseOperatorFunction(): Do not strip argument off unary member operators
Comparison operators like bool operator==(Foo lhs, Foo rhs); are rewritten as class Foo { bool operator==(Foo rhs); and attached to the class. This handling causes existing member operators class QLine { bool operator==(QLine); to be stripped to class QLine { bool operator==(); causing crashes later on. Prevent by checking the argument count. Task-number: PYSIDE-323 Change-Id: I1d566192408404324e25a892db7094679cb81ab7 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
-rw-r--r--ApiExtractor/abstractmetabuilder.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/ApiExtractor/abstractmetabuilder.cpp b/ApiExtractor/abstractmetabuilder.cpp
index 089fedbc5..2ce8e057a 100644
--- a/ApiExtractor/abstractmetabuilder.cpp
+++ b/ApiExtractor/abstractmetabuilder.cpp
@@ -323,7 +323,8 @@ void AbstractMetaBuilderPrivate::traverseOperatorFunction(FunctionModelItem item
AbstractMetaClass* oldCurrentClass = m_currentClass;
m_currentClass = baseoperandClass;
AbstractMetaFunction *metaFunction = traverseFunction(item);
- if (metaFunction && !metaFunction->isInvalid()) {
+ // Strip first argument off "bool operator==(Foo lhs, Foo rhs); }"
+ if (metaFunction && !metaFunction->isInvalid() && metaFunction->arguments().size() > 1) {
// Strip away first argument, since that is the containing object
AbstractMetaArgumentList arguments = metaFunction->arguments();
if (firstArgumentIsSelf || unaryOperator) {