Browse Source

Fixed the handling of covariant returned types.

Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
pull/696/head
Dimitar Dobrev 9 years ago
parent
commit
7da5acda65
  1. 8
      src/Generator/Passes/CheckVirtualOverrideReturnCovariance.cs
  2. 2
      tests/Common/Common.h

8
src/Generator/Passes/CheckVirtualOverrideReturnCovariance.cs

@ -74,10 +74,8 @@ namespace CppSharp.Passes @@ -74,10 +74,8 @@ namespace CppSharp.Passes
static bool IsDescendentOf(Class @class, Class parent)
{
if (!@class.HasBaseClass)
return @class == parent;
return IsDescendentOf(@class.BaseClass, parent);
return @class == parent ||
(@class.HasBaseClass && IsDescendentOf(@class.BaseClass, parent));
}
public bool VisitClassDecl(Class @class)
@ -322,7 +320,7 @@ namespace CppSharp.Passes @@ -322,7 +320,7 @@ namespace CppSharp.Passes
/// </summary>
public class CheckVirtualOverrideReturnCovariance : TranslationUnitPass
{
public override bool VisitMethodDecl(AST.Method method)
public override bool VisitMethodDecl(Method method)
{
if (!VisitDeclaration(method))
return false;

2
tests/Common/Common.h

@ -240,7 +240,7 @@ typedef Exception Ex1; @@ -240,7 +240,7 @@ typedef Exception Ex1;
struct DerivedException;
typedef DerivedException Ex2;
struct DLL_API Exception
struct DLL_API Exception : public Foo
{
virtual Ex1* clone() = 0;
};

Loading…
Cancel
Save