Skip to content

Commit 202ae75

Browse files
committed
Fixed the generated code in a case of ambiguous overloads.
Signed-off-by: Dimitar Dobrev <[email protected]>
1 parent a491350 commit 202ae75

File tree

4 files changed

+15
-1
lines changed

4 files changed

+15
-1
lines changed

src/AST/Type.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ public override bool Equals(object obj)
356356
var type = obj as PointerType;
357357
if (type == null) return false;
358358

359-
return QualifiedPointee.Equals(type.QualifiedPointee)
359+
return Pointee.Equals(type.Pointee)
360360
&& Modifier == type.Modifier;
361361
}
362362

tests/Common/Common.Tests.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ public void TestCodeGeneration()
2424
{
2525
Bar bar = foo;
2626
Assert.IsTrue(Bar.Item.Item1 == bar);
27+
28+
using (var hasOverloadsWithDifferentPointerKindsToSameType =
29+
new HasOverloadsWithDifferentPointerKindsToSameType())
30+
hasOverloadsWithDifferentPointerKindsToSameType.Overload(foo, 0);
2731
}
2832
using (var overridesNonDirectVirtual = new OverridesNonDirectVirtual())
2933
{

tests/Common/Common.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -845,6 +845,14 @@ void HasOverloadsWithDifferentPointerKindsToSameType::overload(const int& i)
845845
{
846846
}
847847

848+
void HasOverloadsWithDifferentPointerKindsToSameType::overload(const Foo& rx, int from)
849+
{
850+
}
851+
852+
void HasOverloadsWithDifferentPointerKindsToSameType::overload(Foo& rx, int from)
853+
{
854+
}
855+
848856
void HasOverloadsWithDifferentPointerKindsToSameType::dispose()
849857
{
850858
}

tests/Common/Common.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1308,6 +1308,8 @@ class DLL_API HasOverloadsWithDifferentPointerKindsToSameType
13081308
void overload(int& i);
13091309
void overload(int&& i);
13101310
void overload(const int& i);
1311+
void overload(const Foo& rx, int from = -1);
1312+
void overload(Foo& rx, int from = -1);
13111313
void dispose();
13121314
};
13131315

0 commit comments

Comments
 (0)