diff --git a/src/Generator/Types/Types.cs b/src/Generator/Types/Types.cs index 3549fb63..8d1393d9 100644 --- a/src/Generator/Types/Types.cs +++ b/src/Generator/Types/Types.cs @@ -127,6 +127,17 @@ namespace CppSharp Ignore(); return base.VisitTemplateSpecializationType(template, quals); + } + + public override bool VisitFunctionType(FunctionType function, TypeQualifiers quals) + { + // We don't know how to marshal non-static member functions + if (function.CallingConvention == CallingConvention.ThisCall) + { + Ignore(); + return false; + } + return base.VisitFunctionType(function, quals); } } diff --git a/tests/Basic/Basic.h b/tests/Basic/Basic.h index d839385c..b47d7471 100644 --- a/tests/Basic/Basic.h +++ b/tests/Basic/Basic.h @@ -243,12 +243,16 @@ typedef int (*DelegateInGlobalNamespace)(int); struct DLL_API TestDelegates { typedef int (*DelegateInClass)(int); + typedef int(TestDelegates::*MemberDelegate)(int); - TestDelegates() : A(Double), B(Double) {} + TestDelegates() : A(Double), B(Double) { C = &TestDelegates::Triple; } static int Double(int N) { return N * 2; } + int Triple(int N) { return N * 3; } DelegateInClass A; DelegateInGlobalNamespace B; + // As long as we can't marshal them make sure they're ignored + MemberDelegate C; }; // Tests memory leaks in constructors