From a44308b3ad59ec48840cb34184e6a6a9744c5c13 Mon Sep 17 00:00:00 2001 From: Dimitar Dobrev Date: Mon, 11 May 2020 00:56:28 +0300 Subject: [PATCH] Test override secondary base Itanium. Signed-off-by: Dimitar Dobrev --- tests/CSharp/CSharp.Tests.cs | 18 +++++++++++++++ tests/CSharp/CSharp.cpp | 44 ++++++++++++++++++++++++++++++++++++ tests/CSharp/CSharp.h | 27 ++++++++++++++++++++++ 3 files changed, 89 insertions(+) diff --git a/tests/CSharp/CSharp.Tests.cs b/tests/CSharp/CSharp.Tests.cs index ff438d49..0dce748a 100644 --- a/tests/CSharp/CSharp.Tests.cs +++ b/tests/CSharp/CSharp.Tests.cs @@ -102,6 +102,24 @@ public unsafe class CSharpTests : GeneratorTestFixture #pragma warning restore 0219 } + class MyClass : Der + { + public override int F => 10; + } + + [Test] + public void TestDer() + { + using (var der = new MyClass()) + { + using (var hasDer = new HasDer()) + { + hasDer.SetDer(der); + Assert.That(hasDer.CallDer(), Is.EqualTo(10)); + } + } + } + [Test] public void TestReturnCharPointer() { diff --git a/tests/CSharp/CSharp.cpp b/tests/CSharp/CSharp.cpp index 024c9833..37b5536b 100644 --- a/tests/CSharp/CSharp.cpp +++ b/tests/CSharp/CSharp.cpp @@ -865,6 +865,50 @@ AbstractWithProperty::~AbstractWithProperty() { } +SB::SB() +{ +} + +SB::~SB() +{ +} + +int SB::f() +{ + return 5; +} + +Der::Der() +{ +} + +Der::~Der() +{ +} + +int Der::derf() +{ + return 55; +} + +HasDer::HasDer() +{ +} + +HasDer::~HasDer() +{ +} + +void HasDer::setDer(Der* value) +{ + der = value; +} + +int HasDer::callDer() +{ + return der->f(); +} + IgnoredType PropertyWithIgnoredType::ignoredType() { return _ignoredType; diff --git a/tests/CSharp/CSharp.h b/tests/CSharp/CSharp.h index 500d8fcd..f56a3f83 100644 --- a/tests/CSharp/CSharp.h +++ b/tests/CSharp/CSharp.h @@ -537,6 +537,33 @@ class DLL_API IgnoredTypeInheritingNonIgnoredWithNoEmptyCtor : public P { }; +class DLL_API SB +{ +public: + SB(); + ~SB(); + virtual int f(); +}; + +class DLL_API Der : public Foo, public SB +{ +public: + Der(); + ~Der(); + virtual int derf(); +}; + +class DLL_API HasDer +{ +public: + HasDer(); + ~HasDer(); + void setDer(Der* value); + int callDer(); +private: + Der* der = 0; +}; + class DLL_API PropertyWithIgnoredType { public: