Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/Generator/Passes/CheckVirtualOverrideReturnCovariance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,19 @@ public override bool VisitTagType(TagType tag, TypeQualifiers quals)
return tag.Declaration.Visit(this);
}

public override bool VisitTemplateSpecializationType(TemplateSpecializationType template,
TypeQualifiers quals)
{
if (!currentType.Qualifiers.Equals(quals))
return false;

var currentTemplateType = currentType.Type as TemplateSpecializationType;
if (currentTemplateType == null)
return false;

return currentTemplateType.Equals(template);
}

static bool IsDescendentOf(Class @class, Class parent)
{
return @class == parent ||
Expand Down
15 changes: 15 additions & 0 deletions tests/Common/Common.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#endif
#include <string>
#include <vector>
#include <memory>

class DLL_API TestPacking
{
Expand Down Expand Up @@ -1522,3 +1523,17 @@ struct DLL_API StructWithCopyCtor
};

uint16_t DLL_API TestStructWithCopyCtorByValue(StructWithCopyCtor s);

// Issue: https://github.com/mono/CppSharp/issues/1266
struct BaseCovariant;
typedef std::unique_ptr<BaseCovariant> PtrCovariant;

struct BaseCovariant {
virtual PtrCovariant clone() const = 0;
};

struct DerivedCovariant: public BaseCovariant {
std::unique_ptr<BaseCovariant> clone() const override {
return PtrCovariant(new DerivedCovariant());
}
};