diff --git a/src/Generator/Generators/CSharp/CSharpExpressionPrinter.cs b/src/Generator/Generators/CSharp/CSharpExpressionPrinter.cs index c4c2f1d5..c625164a 100644 --- a/src/Generator/Generators/CSharp/CSharpExpressionPrinter.cs +++ b/src/Generator/Generators/CSharp/CSharpExpressionPrinter.cs @@ -27,11 +27,11 @@ namespace CppSharp.Generators.CSharp if (desugared.IsPrimitiveType() && (parameter.DefaultArgument.Declaration != null || parameter.DefaultArgument.Class == StatementClass.BinaryOperator)) - return $"({desugared.Visit(typePrinter)}) {expression}"; + return $"({desugared.Visit(typePrinter)}) ({expression})"; var finalType = (desugared.GetFinalPointee() ?? desugared).Desugar(); if (finalType.TryGetClass(out var @class) && @class.IsInterface) return $@"({@class.Visit(typePrinter)}) ({ - @class.OriginalClass.Visit(typePrinter)}) {expression}"; + @class.OriginalClass.Visit(typePrinter)}) ({expression})"; return expression; } @@ -88,4 +88,4 @@ namespace CppSharp.Generators.CSharp private readonly TypePrinter typePrinter; } -} \ No newline at end of file +} diff --git a/tests/dotnet/Common/Common.cpp b/tests/dotnet/Common/Common.cpp index 04d63cdd..d985b92c 100644 --- a/tests/dotnet/Common/Common.cpp +++ b/tests/dotnet/Common/Common.cpp @@ -1273,4 +1273,8 @@ extern "C" s.field2 = 10; return s; } -} // extern "C" \ No newline at end of file +} // extern "C" + +void DLL_API FunctionWithFlagsAsDefaultParameter(int defaultParam) +{ +} diff --git a/tests/dotnet/Common/Common.h b/tests/dotnet/Common/Common.h index c018c422..3b4af82c 100644 --- a/tests/dotnet/Common/Common.h +++ b/tests/dotnet/Common/Common.h @@ -1567,3 +1567,5 @@ extern "C" DLL_API void takeConflictName(struct system* self); DLL_API struct system freeFunctionReturnByValue(); } // extern "C" + +void DLL_API FunctionWithFlagsAsDefaultParameter(int defaultParam = A | B);