Handle non-TagDecl bases by ignoring them (#89)
@ -213,7 +213,7 @@ namespace CppSharp.AST
public Method GetRootBaseMethod(Method @override, bool onlyFirstBase = false)
{
return (from @base in Bases
where !onlyFirstBase || !@base.Class.IsInterface
where @base.IsClass && (!onlyFirstBase || !@base.Class.IsInterface)
let baseMethod = (
from method in @base.Class.Methods
where
@ -545,7 +545,7 @@ namespace CppSharp.Generators.CLI
private bool GenerateClassConstructorBase(Class @class, bool isIntPtr, Method method = null)
var hasBase = @class.HasBase && !@class.Bases[0].Class.Ignore;
var hasBase = @class.HasBase && @class.Bases[0].IsClass && !@class.Bases[0].Class.Ignore;
if (!hasBase)
return false;
@ -716,6 +716,7 @@ namespace CppSharp.Generators.CSharp
bases.AddRange(
from @base in @class.Bases
where @base.IsClass
select QualifiedIdentifier(@base.Class));
}
@ -153,3 +153,14 @@ struct DLL_API DefaultParameters
void Bar() const;
void Bar();
};
// The Curiously Recurring Template Pattern (CRTP)
template<class Derived>
class Base
// methods within Base can use template to access members of Derived
Derived* create() { return new Derived(); }
class Derived : public Base<Derived>