diff --git a/src/Generator/Generators/CSharp/CSharpSources.cs b/src/Generator/Generators/CSharp/CSharpSources.cs index f4246f89a9..df09a91a8c 100644 --- a/src/Generator/Generators/CSharp/CSharpSources.cs +++ b/src/Generator/Generators/CSharp/CSharpSources.cs @@ -2901,7 +2901,6 @@ public void GenerateFunctionCall(string functionName, List parameters 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 0e7fc348e1..b2522aa36d 100644 --- a/tests/CSharp/CSharp.Tests.cs +++ b/tests/CSharp/CSharp.Tests.cs @@ -248,7 +248,7 @@ public void TestDefaultArguments() methodsWithDefaultValues.DefaultEmptyEnum(); methodsWithDefaultValues.DefaultRefTypeBeforeOthers(); methodsWithDefaultValues.DefaultRefTypeAfterOthers(); - methodsWithDefaultValues.DefaultRefTypeBeforeAndAfterOthers(0, null); + methodsWithDefaultValues.DefaultRefTypeBeforeAndAfterOthers(); methodsWithDefaultValues.DefaultIntAssignedAnEnum(); methodsWithDefaultValues.defaultRefAssignedValue(); methodsWithDefaultValues.DefaultRefAssignedValue(); @@ -1276,7 +1276,17 @@ public void TestConstCharStarRef() } [Test] - public void Test() + public void TestImplicitConversionToString() + { + using (Foo foo = new Foo("name")) + { + string name = foo; + Assert.That(name, Is.EqualTo("name")); + } + } + + [Test] + public void TestHasFunctionPointerField() { using (var hasFunctionPtrField = new HasFunctionPtrField()) { diff --git a/tests/CSharp/CSharp.cpp b/tests/CSharp/CSharp.cpp index d5a4fcb661..663a7a7de9 100644 --- a/tests/CSharp/CSharp.cpp +++ b/tests/CSharp/CSharp.cpp @@ -8,10 +8,20 @@ Foo::Foo(const QString& name) Foo::Foo(const char* name) : publicFieldMappedToEnum(TestFlag::Flag2) { + if (name) + { + _name = name; + } A = 10; P = 50; } +Foo::Foo(const Foo& other) : A(other.A), P(other.P), + templateInAnotherUnit(other.templateInAnotherUnit), + _name(other._name) +{ +} + Foo::Foo(int a, int p) : publicFieldMappedToEnum(TestFlag::Flag2) { A = a; @@ -26,6 +36,10 @@ Foo::Foo(wchar_t ch) { } +Foo::~Foo() +{ +} + int Foo::method() { return 1; @@ -104,6 +118,11 @@ int Foo::operator --() return 4; } +Foo::operator const char*() const +{ + return _name.data(); +} + const Foo& Bar::operator[](int i) const { return m_foo; @@ -215,6 +234,10 @@ Bar::Bar(Items item) { } +Bar::~Bar() +{ +} + int Bar::method() { return 2; @@ -263,10 +286,18 @@ ForceCreationOfInterface::ForceCreationOfInterface() { } +ForceCreationOfInterface::~ForceCreationOfInterface() +{ +} + Baz::Baz(Bar::Items item) { } +Baz::~Baz() +{ +} + int Baz::takesQux(const Qux& qux) { return qux.farAwayFunc(); @@ -974,6 +1005,10 @@ InheritsProtectedVirtualFromSecondaryBase::InheritsProtectedVirtualFromSecondary { } +InheritsProtectedVirtualFromSecondaryBase::~InheritsProtectedVirtualFromSecondaryBase() +{ +} + void InheritsProtectedVirtualFromSecondaryBase::protectedVirtual() { } diff --git a/tests/CSharp/CSharp.h b/tests/CSharp/CSharp.h index 21efb7ba4c..4b42cb604a 100644 --- a/tests/CSharp/CSharp.h +++ b/tests/CSharp/CSharp.h @@ -13,9 +13,11 @@ class DLL_API Foo public: Foo(const QString& name); Foo(const char* name = 0); + Foo(const Foo& other); Foo(int a, int p = 0); Foo(char16_t ch); Foo(wchar_t ch); + ~Foo(); int method(); int operator[](int i) const; int operator[](unsigned int i); @@ -38,6 +40,7 @@ class DLL_API Foo int operator ++(); int operator --(); + operator const char*() const; bool btest[5]; QFlags publicFieldMappedToEnum; @@ -45,6 +48,7 @@ class DLL_API Foo protected: int P; TemplateInAnotherUnit templateInAnotherUnit; + std::string _name; }; class DLL_API Quux @@ -93,6 +97,7 @@ class DLL_API Bar : public Qux Bar(); Bar(Qux qux); Bar(Items item); + ~Bar(); int method(); const Foo& operator[](int i) const; Foo& operator[](int i); @@ -121,6 +126,7 @@ class DLL_API ForceCreationOfInterface : public Foo, public Bar { public: ForceCreationOfInterface(); + ~ForceCreationOfInterface(); }; class DLL_API Baz : public Foo, public Bar @@ -136,6 +142,7 @@ class DLL_API Baz : public Foo, public Bar Baz(); Baz(Bar::Items item); + ~Baz(); int P; @@ -734,6 +741,7 @@ class DLL_API InheritsProtectedVirtualFromSecondaryBase : public InheritanceBuff { public: InheritsProtectedVirtualFromSecondaryBase(); + ~InheritsProtectedVirtualFromSecondaryBase(); protected: void protectedVirtual(); };