Skip to content

Commit

Permalink
Bind default constructors with dependent pointers
Browse files Browse the repository at this point in the history
Signed-off-by: Dimitar Dobrev <[email protected]>
  • Loading branch information
ddobrev committed Aug 31, 2021
1 parent 2fdd082 commit c36145b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/AST/FunctionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public static bool CanOverride(this Method @override, Method method)

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 &&
Expand Down
4 changes: 3 additions & 1 deletion tests/CSharp/CSharp.Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1334,8 +1334,10 @@ public void TestExtensionsOfSpecializationsAsSecondaryBases()
[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));
}
}

Expand Down
4 changes: 2 additions & 2 deletions tests/CSharp/CSharpTemplates.h
Original file line number Diff line number Diff line change
Expand Up @@ -260,15 +260,15 @@ template <typename T>
class DependentPointerFields
{
public:
DependentPointerFields(T t = 0);
DependentPointerFields(T* t = 0);
~DependentPointerFields();
T property();
T takeField(T t);
T* field;
};

template <typename T>
DependentPointerFields<T>::DependentPointerFields(T t)
DependentPointerFields<T>::DependentPointerFields(T* t) : field(t)
{
}

Expand Down

0 comments on commit c36145b

Please sign in to comment.