Browse Source

Fixed the issue about member pointers not pointing to a function. Turns out this is some "pointer to a data member" (?!) that is of little use so just ignore it.

Signed-off-by: Dimitar Dobrev <dpldobrev@yahoo.com>
pull/72/head
Dimitar Dobrev 12 years ago
parent
commit
d2e7e99bc3
  1. 24
      src/Generator/Passes/CheckOperatorsOverloads.cs
  2. 11
      src/Generator/Types/Types.cs

24
src/Generator/Passes/CheckOperatorsOverloads.cs

@ -83,30 +83,6 @@ namespace CppSharp.Passes @@ -83,30 +83,6 @@ namespace CppSharp.Passes
Kind = ParameterKind.OperatorParameter
});
}
// HACK: in Qt's qobjectdefs.h we have this line:
// typedef void *Connection::*RestrictedBool;
// Our parser resolves this as a function pointer while judging by the next line of:
// operator RestrictedBool() const { return d_ptr ? &Connection::d_ptr : 0; }
// it seems not to be. So until the proper fix just use the pointee to avoid crashes
if (@operator.OperatorKind == CXXOperatorKind.Conversion)
{
var typedef = @operator.ReturnType.Type as TypedefType;
if (typedef != null)
{
var functionPointer = typedef.Desugar() as MemberPointerType;
if (functionPointer != null)
{
FunctionType functionType;
functionPointer.IsPointerTo(out functionType);
if (functionType == null)
{
@operator.ReturnType =
new QualifiedType(functionPointer.Pointee,
@operator.ReturnType.Qualifiers);
}
}
}
}
}
}

11
src/Generator/Types/Types.cs

@ -97,6 +97,17 @@ namespace CppSharp @@ -97,6 +97,17 @@ namespace CppSharp
return base.VisitTypedefDecl(typedef);
}
public override bool VisitMemberPointerType(MemberPointerType member, TypeQualifiers quals)
{
FunctionType functionType;
if (!member.IsPointerTo(out functionType))
{
Ignore();
return false;
}
return base.VisitMemberPointerType(member, quals);
}
public override bool VisitTemplateSpecializationType(
TemplateSpecializationType template, TypeQualifiers quals)
{

Loading…
Cancel
Save