diff --git a/src/AST/ClassExtensions.cs b/src/AST/ClassExtensions.cs index 2355cc0b..2420ff25 100644 --- a/src/AST/ClassExtensions.cs +++ b/src/AST/ClassExtensions.cs @@ -43,11 +43,11 @@ namespace CppSharp.AST } } - public static Class GetRootBase(this Class @class) + public static Class GetNonIgnoredRootBase(this Class @class) { while (true) { - if (@class.BaseClass == null) + if (!@class.HasNonIgnoredBase || @class.BaseClass == null) return @class; @class = @class.BaseClass; diff --git a/src/Generator/Generators/CSharp/CSharpTextTemplate.cs b/src/Generator/Generators/CSharp/CSharpTextTemplate.cs index e4f5a24d..0600a7d1 100644 --- a/src/Generator/Generators/CSharp/CSharpTextTemplate.cs +++ b/src/Generator/Generators/CSharp/CSharpTextTemplate.cs @@ -1784,7 +1784,7 @@ namespace CppSharp.Generators.CSharp if (@class.IsRefType) { - var @base = @class.GetRootBase(); + var @base = @class.GetNonIgnoredRootBase(); var className = @base.IsAbstractImpl ? @base.BaseClass.Name : @base.Name; // Use interfaces if any - derived types with a this class as a seconary base, must be compatible with the map diff --git a/tests/CSharpTemp/CSharpTemp.h b/tests/CSharpTemp/CSharpTemp.h index 21f438f4..f7944290 100644 --- a/tests/CSharpTemp/CSharpTemp.h +++ b/tests/CSharpTemp/CSharpTemp.h @@ -230,6 +230,10 @@ private: const char* _name; }; +class TestObjectMapWithClassDerivedFromStruct : public QGenericArgument +{ +}; + #define DEFAULT_INT (2 * 1000UL + 500UL) namespace Qt