From 5f54d0b555007fab04784ac99fd97ed55890ef9f Mon Sep 17 00:00:00 2001 From: Dimitar Dobrev Date: Thu, 30 Oct 2014 22:08:49 +0200 Subject: [PATCH] Fixed incompilable code generated by the C++/CLI back-end when wrapping certain unions. Signed-off-by: Dimitar Dobrev --- src/Generator/Generators/CLI/CLISourcesTemplate.cs | 3 ++- tests/Basic/Basic.h | 12 +++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/Generator/Generators/CLI/CLISourcesTemplate.cs b/src/Generator/Generators/CLI/CLISourcesTemplate.cs index 51510662..df6abf43 100644 --- a/src/Generator/Generators/CLI/CLISourcesTemplate.cs +++ b/src/Generator/Generators/CLI/CLISourcesTemplate.cs @@ -662,7 +662,8 @@ namespace CppSharp.Generators.CLI { ArgName = property.Name, ReturnVarName = nativeField, - ReturnType = property.QualifiedType + ReturnType = property.QualifiedType, + Declaration = property.Field }; var marshal = new CLIMarshalNativeToManagedPrinter(ctx); diff --git a/tests/Basic/Basic.h b/tests/Basic/Basic.h index 8cb9485f..2230e4d6 100644 --- a/tests/Basic/Basic.h +++ b/tests/Basic/Basic.h @@ -602,14 +602,24 @@ public: DLL_API void va_listFunction(va_list v); -struct DLL_API TestEmptyName +struct DLL_API TestNestedTypes { +public: struct { struct { }; }; + + union as_types + { + int as_int; + struct uchars + { + unsigned char blue, green, red, alpha; + } as_uchar; + }; }; class DLL_API HasStdString