diff options
author | Hugo Parente Lima <hugo.pl@gmail.com> | 2011-04-14 11:33:11 -0300 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2012-03-08 16:15:21 -0300 |
commit | 660893caca7ebbe96c85ab33f53fc8d99fbabdc0 (patch) | |
tree | d4a78886b693f976e5ec6b09308381b865879c89 /generator | |
parent | 1155fe8c710818eac3c0490724b34adef95d9999 (diff) |
Fix bug regarding to two overloads like: foo(char) and foo(const char*)
The overload decisor was unable to find the difference between them.
This code was wrote by Setanta in an experimental branch, so kudos to him.
Diffstat (limited to 'generator')
-rw-r--r-- | generator/overloaddata.cpp | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/generator/overloaddata.cpp b/generator/overloaddata.cpp index 3a32c94d6..7e3f608cd 100644 --- a/generator/overloaddata.cpp +++ b/generator/overloaddata.cpp @@ -60,17 +60,21 @@ static QString getTypeName(const OverloadData* ov) static bool typesAreEqual(const AbstractMetaType* typeA, const AbstractMetaType* typeB) { - - bool equal = typeA->typeEntry() == typeB->typeEntry(); - if (equal && typeA->isContainer()) { - if (typeA->instantiations().size() != typeB->instantiations().size()) - return false; - for (int i = 0; i < typeA->instantiations().size(); ++i) { - if (!typesAreEqual(typeA->instantiations().at(i), typeB->instantiations().at(i))) + if (typeA->typeEntry() == typeB->typeEntry()) { + if (typeA->isContainer()) { + if (typeA->instantiations().size() != typeB->instantiations().size()) return false; + + for (int i = 0; i < typeA->instantiations().size(); ++i) { + if (!typesAreEqual(typeA->instantiations().at(i), typeB->instantiations().at(i))) + return false; + } + return true; } + + return !(ShibokenGenerator::isCString(typeA) ^ ShibokenGenerator::isCString(typeB)); } - return equal; + return false; } /** @@ -226,7 +230,8 @@ void OverloadData::sortNextOverloads() "unsigned char", "char", "float", - "double" + "double", + "const char*" }; const int numPrimitives = sizeof(primitiveTypes)/sizeof(const char*); bool hasPrimitive[numPrimitives]; |