diff --git a/src/Generator/Passes/HandleDefaultParamValuesPass.cs b/src/Generator/Passes/HandleDefaultParamValuesPass.cs index 18c51598..5e42aa6e 100644 --- a/src/Generator/Passes/HandleDefaultParamValuesPass.cs +++ b/src/Generator/Passes/HandleDefaultParamValuesPass.cs @@ -5,7 +5,6 @@ using CppSharp.AST; using CppSharp.AST.Extensions; using CppSharp.Generators.CSharp; using CppSharp.Types; -using Type = CppSharp.AST.Type; namespace CppSharp.Passes { @@ -14,7 +13,7 @@ namespace CppSharp.Passes private static readonly Regex regexFunctionParams = new Regex(@"\(?(.+)\)?", RegexOptions.Compiled); private static readonly Regex regexDoubleColon = new Regex(@"\w+::", RegexOptions.Compiled); private static readonly Regex regexName = new Regex(@"(\w+)", RegexOptions.Compiled); - private static readonly Regex regexCtor = new Regex(@"^([\w<,>:]+)\s*(\(\w*\))$", RegexOptions.Compiled); + private static readonly Regex regexCtor = new Regex(@"^([\w<,>:]+)\s*(\([\w, ]*\))$", RegexOptions.Compiled); public HandleDefaultParamValuesPass() { diff --git a/tests/CSharpTemp/CSharpTemp.Tests.cs b/tests/CSharpTemp/CSharpTemp.Tests.cs index 2f7eb831..6de8c429 100644 --- a/tests/CSharpTemp/CSharpTemp.Tests.cs +++ b/tests/CSharpTemp/CSharpTemp.Tests.cs @@ -153,6 +153,7 @@ public class CSharpTempTests : GeneratorTestFixture methodsWithDefaultValues.DefaultPointerToValueType(); methodsWithDefaultValues.DefaultDoubleWithoutF(); methodsWithDefaultValues.DefaultIntExpressionWithEnum(); + methodsWithDefaultValues.DefaultCtorWithMoreThanOneArg(); } [Test] diff --git a/tests/CSharpTemp/CSharpTemp.cpp b/tests/CSharpTemp/CSharpTemp.cpp index 08b7b87f..0d58ab97 100644 --- a/tests/CSharpTemp/CSharpTemp.cpp +++ b/tests/CSharpTemp/CSharpTemp.cpp @@ -289,6 +289,10 @@ QGenericArgument::QGenericArgument(const char *name) _name = name; } +MethodsWithDefaultValues::QMargins::QMargins(int left, int top, int right, int bottom) +{ +} + MethodsWithDefaultValues::MethodsWithDefaultValues(Foo foo) { m_foo = foo; @@ -403,6 +407,10 @@ void MethodsWithDefaultValues::defaultIntExpressionWithEnum(int i) { } +void MethodsWithDefaultValues::defaultCtorWithMoreThanOneArg(QMargins m) +{ +} + int MethodsWithDefaultValues::getA() { return m_foo.A; diff --git a/tests/CSharpTemp/CSharpTemp.h b/tests/CSharpTemp/CSharpTemp.h index a9f0072f..be3b147b 100644 --- a/tests/CSharpTemp/CSharpTemp.h +++ b/tests/CSharpTemp/CSharpTemp.h @@ -265,6 +265,12 @@ class QList class DLL_API MethodsWithDefaultValues : public Quux { public: + class DLL_API QMargins + { + public: + QMargins(int left, int top, int right, int bottom); + }; + MethodsWithDefaultValues(Foo foo = Foo()); MethodsWithDefaultValues(int a); MethodsWithDefaultValues(double d, QList list = QList()); @@ -293,6 +299,7 @@ public: void defaultPointerToValueType(QGenericArgument* pointer = 0); void defaultDoubleWithoutF(double d1 = 1.0, double d2 = 1.); void defaultIntExpressionWithEnum(int i = Qt::GlobalColor::black + 1); + void defaultCtorWithMoreThanOneArg(QMargins m = QMargins(0, 0, 0, 0)); int getA(); private: Foo m_foo;