From ba03f64f65cc88fdcd27292a35b4d297172844b1 Mon Sep 17 00:00:00 2001 From: Elias Holzer Date: Fri, 11 Apr 2014 16:38:10 +0200 Subject: [PATCH] Do not write the fixed keyword multiple times for nested array types. --- src/Generator/Generators/CSharp/CSharpTypePrinter.cs | 4 +++- tests/Basic/Basic.h | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Generator/Generators/CSharp/CSharpTypePrinter.cs b/src/Generator/Generators/CSharp/CSharpTypePrinter.cs index 5930afb1..b0c098fb 100644 --- a/src/Generator/Generators/CSharp/CSharpTypePrinter.cs +++ b/src/Generator/Generators/CSharp/CSharpTypePrinter.cs @@ -127,9 +127,11 @@ namespace CppSharp.Generators.CSharp Type = string.Format("{0}*", array.Type.Visit(this, quals)) }; } + // Do not write the fixed keyword multiple times for nested array types + var fixedKeyword = array.Type is ArrayType ? string.Empty : "fixed "; return new CSharpTypePrinterResult() { - Type = string.Format("fixed {0}", array.Type.Visit(this, quals)), + Type = string.Format("{0}{1}", fixedKeyword, array.Type.Visit(this, quals)), NameSuffix = string.Format("[{0}]", array.Size) }; } diff --git a/tests/Basic/Basic.h b/tests/Basic/Basic.h index 1c10b8cb..490d7072 100644 --- a/tests/Basic/Basic.h +++ b/tests/Basic/Basic.h @@ -17,6 +17,8 @@ public: const char* GetANSI(); // TODO: VC++ does not support char16 // char16 chr16; + + float nested_array[2][2]; }; struct DLL_API Bar