diff --git a/src/Generator/Generators/CSharp/CSharpSources.cs b/src/Generator/Generators/CSharp/CSharpSources.cs index f4246f89..df09a91a 100644 --- a/src/Generator/Generators/CSharp/CSharpSources.cs +++ b/src/Generator/Generators/CSharp/CSharpSources.cs @@ -2901,7 +2901,6 @@ namespace CppSharp.Generators.CSharp ArgName = Helpers.ReturnIdentifier, ReturnVarName = Helpers.ReturnIdentifier, ReturnType = returnType, - Parameter = operatorParam, Function = function }; diff --git a/tests/CSharp/CSharp.Tests.cs b/tests/CSharp/CSharp.Tests.cs index 0e7fc348..0149ecf6 100644 --- a/tests/CSharp/CSharp.Tests.cs +++ b/tests/CSharp/CSharp.Tests.cs @@ -1276,7 +1276,17 @@ public unsafe class CSharpTests : GeneratorTestFixture } [Test] - public void Test() + public void TestImplicitConversionToString() + { + using (Foo foo = new Foo()) + { + string name = foo; + Assert.That(name, Is.EqualTo("test")); + } + } + + [Test] + public void TestHasFunctionPointerField() { using (var hasFunctionPtrField = new HasFunctionPtrField()) { diff --git a/tests/CSharp/CSharp.cpp b/tests/CSharp/CSharp.cpp index d5a4fcb6..4bcf2ce9 100644 --- a/tests/CSharp/CSharp.cpp +++ b/tests/CSharp/CSharp.cpp @@ -104,6 +104,11 @@ int Foo::operator --() return 4; } +Foo::operator const char*() const +{ + return "test"; +} + const Foo& Bar::operator[](int i) const { return m_foo; diff --git a/tests/CSharp/CSharp.h b/tests/CSharp/CSharp.h index 21efb7ba..0a049172 100644 --- a/tests/CSharp/CSharp.h +++ b/tests/CSharp/CSharp.h @@ -38,6 +38,7 @@ public: int operator ++(); int operator --(); + operator const char*() const; bool btest[5]; QFlags publicFieldMappedToEnum;