Skip to content

Commit c36145b

Browse files
committed
Bind default constructors with dependent pointers
Signed-off-by: Dimitar Dobrev <[email protected]>
1 parent 2fdd082 commit c36145b

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

src/AST/FunctionExtensions.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public static bool CanOverride(this Method @override, Method method)
9595

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

tests/CSharp/CSharp.Tests.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1334,8 +1334,10 @@ public void TestExtensionsOfSpecializationsAsSecondaryBases()
13341334
[Test]
13351335
public void TestFieldWithDependentPointerType()
13361336
{
1337-
using (var dependentPointerFields = new DependentPointerFields<float>(0))
1337+
float f = 0.5f;
1338+
using (var dependentPointerFields = DependentPointerFieldsExtensions.DependentPointerFields(ref f))
13381339
{
1340+
Assert.That(dependentPointerFields.Property, Is.EqualTo(f));
13391341
}
13401342
}
13411343

tests/CSharp/CSharpTemplates.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -260,15 +260,15 @@ template <typename T>
260260
class DependentPointerFields
261261
{
262262
public:
263-
DependentPointerFields(T t = 0);
263+
DependentPointerFields(T* t = 0);
264264
~DependentPointerFields();
265265
T property();
266266
T takeField(T t);
267267
T* field;
268268
};
269269

270270
template <typename T>
271-
DependentPointerFields<T>::DependentPointerFields(T t)
271+
DependentPointerFields<T>::DependentPointerFields(T* t) : field(t)
272272
{
273273
}
274274

0 commit comments

Comments
 (0)