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