From 2091d71242e6dbc3f03a14bc423268a75211c91c Mon Sep 17 00:00:00 2001 From: Dimitar Dobrev Date: Mon, 23 Sep 2013 16:00:37 +0300 Subject: [PATCH] Added a test about the type def - to a function pointer - incorrectly resolved to void*. Signed-off-by: Dimitar Dobrev --- src/Generator/Passes/CheckAmbiguousFunctions.cs | 10 ++++++++++ tests/CSharpTemp/CSharpTemp.h | 3 +++ 2 files changed, 13 insertions(+) diff --git a/src/Generator/Passes/CheckAmbiguousFunctions.cs b/src/Generator/Passes/CheckAmbiguousFunctions.cs index a44f642e..3b04fb46 100644 --- a/src/Generator/Passes/CheckAmbiguousFunctions.cs +++ b/src/Generator/Passes/CheckAmbiguousFunctions.cs @@ -35,6 +35,16 @@ namespace CppSharp.Passes foreach (var overload in overloads) { + if (function.OperatorKind == CXXOperatorKind.Conversion) + { + if (function != overload && + function.OriginalReturnType == overload.OriginalReturnType) + { + overload.ExplicityIgnored = true; + function.IsAmbiguous = true; + } + continue; + } if (overload == function) continue; if (overload.Ignore) continue; diff --git a/tests/CSharpTemp/CSharpTemp.h b/tests/CSharpTemp/CSharpTemp.h index 4ff75db3..d79b7086 100644 --- a/tests/CSharpTemp/CSharpTemp.h +++ b/tests/CSharpTemp/CSharpTemp.h @@ -41,4 +41,7 @@ public: int takesQux(const Qux& qux); Qux returnQux(); operator int() const; + + typedef void *Baz::*FunctionPointerResolvedAsVoidStar; + operator FunctionPointerResolvedAsVoidStar() const { return 0; } };