Browse Source

Bind default constructors with dependent pointers

Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
pull/1632/head
Dimitar Dobrev 4 years ago
parent
commit
c36145b29d
  1. 2
      src/AST/FunctionExtensions.cs
  2. 4
      tests/CSharp/CSharp.Tests.cs
  3. 4
      tests/CSharp/CSharpTemplates.h

2
src/AST/FunctionExtensions.cs

@ -95,7 +95,7 @@ namespace CppSharp.AST @@ -95,7 +95,7 @@ namespace CppSharp.AST
public static bool NeedsSymbol(this Method method)
{
Class @class = (Class) method.Namespace;
Class @class = (Class) (method.OriginalFunction ?? method).Namespace;
// virtual functions cannot really be inlined and
// we don't need their symbols anyway as we call them through the v-table
return (!method.IsVirtual && !method.IsSynthetized &&

4
tests/CSharp/CSharp.Tests.cs

@ -1334,8 +1334,10 @@ public unsafe class CSharpTests @@ -1334,8 +1334,10 @@ public unsafe class CSharpTests
[Test]
public void TestFieldWithDependentPointerType()
{
using (var dependentPointerFields = new DependentPointerFields<float>(0))
float f = 0.5f;
using (var dependentPointerFields = DependentPointerFieldsExtensions.DependentPointerFields(ref f))
{
Assert.That(dependentPointerFields.Property, Is.EqualTo(f));
}
}

4
tests/CSharp/CSharpTemplates.h

@ -260,7 +260,7 @@ template <typename T> @@ -260,7 +260,7 @@ template <typename T>
class DependentPointerFields
{
public:
DependentPointerFields(T t = 0);
DependentPointerFields(T* t = 0);
~DependentPointerFields();
T property();
T takeField(T t);
@ -268,7 +268,7 @@ public: @@ -268,7 +268,7 @@ public:
};
template <typename T>
DependentPointerFields<T>::DependentPointerFields(T t)
DependentPointerFields<T>::DependentPointerFields(T* t) : field(t)
{
}

Loading…
Cancel
Save