diff --git a/src/AST/Type.cs b/src/AST/Type.cs index 13ac6969..321c7fbe 100644 --- a/src/AST/Type.cs +++ b/src/AST/Type.cs @@ -49,6 +49,9 @@ namespace CppSharp.AST public bool IsPointer() { + var functionPointer = this as MemberPointerType; + if (functionPointer != null) + return true; var pointer = this as PointerType; if (pointer == null) return false; @@ -77,6 +80,12 @@ namespace CppSharp.AST if (ptr == null) { + var functionPointer = this as MemberPointerType; + if (functionPointer != null) + { + type = functionPointer.Pointee as T; + return type != null; + } type = null; return false; } diff --git a/src/Generator/Generators/CSharp/CSharpTypePrinter.cs b/src/Generator/Generators/CSharp/CSharpTypePrinter.cs index 6395ea3f..83237d0c 100644 --- a/src/Generator/Generators/CSharp/CSharpTypePrinter.cs +++ b/src/Generator/Generators/CSharp/CSharpTypePrinter.cs @@ -191,7 +191,12 @@ namespace CppSharp.Generators.CSharp public CSharpTypePrinterResult VisitMemberPointerType(MemberPointerType member, TypeQualifiers quals) { - throw new NotImplementedException(); + FunctionType functionType; + if (member.IsPointerTo(out functionType)) + { + return functionType.Visit(this, quals); + } + throw new InvalidOperationException("A function pointer not pointing to a function type."); } public CSharpTypePrinterResult VisitBuiltinType(BuiltinType builtin,