From cff1349d2c0fdfd3f6cdfdd1615502f962ee17bd Mon Sep 17 00:00:00 2001 From: Elias Holzer Date: Fri, 11 Apr 2014 17:55:34 +0200 Subject: [PATCH] Fixed retrieval of method overloads in case the provided function is an operator. --- src/AST/Class.cs | 3 +++ tests/Basic/Basic.h | 11 ++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/AST/Class.cs b/src/AST/Class.cs index 592397c1..88065f73 100644 --- a/src/AST/Class.cs +++ b/src/AST/Class.cs @@ -201,6 +201,9 @@ namespace CppSharp.AST public override IEnumerable GetOverloads(Function function) { + if (function.IsOperator) + return Methods.Where(fn => fn.OperatorKind == function.OperatorKind); + var methods = Methods.Where(m => m.Name == function.Name); if (methods.ToList().Count != 0) return methods; diff --git a/tests/Basic/Basic.h b/tests/Basic/Basic.h index 7819ab7c..6554f53c 100644 --- a/tests/Basic/Basic.h +++ b/tests/Basic/Basic.h @@ -323,4 +323,13 @@ namespace SomeNamespace public: virtual void AbstractMethod() = 0; }; -} \ No newline at end of file +} + +// Test operator overloads +class ClassWithOverloadedOperators +{ +public: + operator char(); + operator int(); + operator short(); +}; \ No newline at end of file