diff options
| author | Rémi Verschelde <remi@verschelde.fr> | 2021-11-29 17:30:13 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-11-29 17:30:13 +0100 |
| commit | 9d3875dde75b95ea172c60188ca345162f2b38b9 (patch) | |
| tree | d6ca0911cec4aaf7b7da022d1ea65c97dd0f097a /core | |
| parent | 76fb6f192765901a32cccf774d414696df1593fe (diff) | |
| parent | 272b3c3728b8bdc69e4086cd6a76bc80aa5d2688 (diff) | |
Merge pull request #55408 from madmiraal/fix-54517
Diffstat (limited to 'core')
| -rw-r--r-- | core/doc_data.h | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/core/doc_data.h b/core/doc_data.h index c75cdfcde5..066cc6b848 100644 --- a/core/doc_data.h +++ b/core/doc_data.h @@ -70,18 +70,29 @@ public: Vector<int> errors_returned; bool operator<(const MethodDoc &p_method) const { if (name == p_method.name) { - // Must be a constructor since there is no overloading. - // We want this arbitrary order for a class "Foo": - // - 1. Default constructor: Foo() - // - 2. Copy constructor: Foo(Foo) - // - 3+. Other constructors Foo(Bar, ...) based on first argument's name - if (arguments.size() == 0 || p_method.arguments.size() == 0) { // 1. + // Must be an operator or a constructor since there is no other overloading + if (name.left(8) == "operator") { + if (arguments.size() == p_method.arguments.size()) { + if (arguments.size() == 0) { + return false; + } + return arguments[0].type < p_method.arguments[0].type; + } return arguments.size() < p_method.arguments.size(); + } else { + // Must be a constructor + // We want this arbitrary order for a class "Foo": + // - 1. Default constructor: Foo() + // - 2. Copy constructor: Foo(Foo) + // - 3+. Other constructors Foo(Bar, ...) based on first argument's name + if (arguments.size() == 0 || p_method.arguments.size() == 0) { // 1. + return arguments.size() < p_method.arguments.size(); + } + if (arguments[0].type == return_type || p_method.arguments[0].type == p_method.return_type) { // 2. + return (arguments[0].type == return_type) || (p_method.arguments[0].type != p_method.return_type); + } + return arguments[0] < p_method.arguments[0]; } - if (arguments[0].type == return_type || p_method.arguments[0].type == p_method.return_type) { // 2. - return (arguments[0].type == return_type) || (p_method.arguments[0].type != p_method.return_type); - } - return arguments[0] < p_method.arguments[0]; } return name < p_method.name; } |