From 8d9ff9515e497743ad7ce914e053fee0d3941c50 Mon Sep 17 00:00:00 2001 From: Dimitar Dobrev Date: Wed, 29 Jan 2014 23:44:34 +0200 Subject: [PATCH] Generated dependent fields if they are of a union type. Signed-off-by: Dimitar Dobrev --- src/Generator/Generators/CSharp/CSharpTextTemplate.cs | 7 +++++-- tests/Basic/Basic.h | 9 +++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/Generator/Generators/CSharp/CSharpTextTemplate.cs b/src/Generator/Generators/CSharp/CSharpTextTemplate.cs index a964d25d..3bf5182c 100644 --- a/src/Generator/Generators/CSharp/CSharpTextTemplate.cs +++ b/src/Generator/Generators/CSharp/CSharpTextTemplate.cs @@ -790,8 +790,11 @@ namespace CppSharp.Generators.CSharp } private void GenerateClassInternalsField(Field field) - { - if (field.Type.IsDependent && !field.Type.IsPointer()) + { + // we do not support dependent fields yet, see https://github.com/mono/CppSharp/issues/197 + Class @class; + if (field.Type.IsDependent && !field.Type.IsPointer() && + !(field.Type.IsTagDecl(out @class) && @class.IsUnion)) return; var safeIdentifier = Helpers.SafeIdentifier(field.OriginalName); diff --git a/tests/Basic/Basic.h b/tests/Basic/Basic.h index d22f8a08..3dcddc76 100644 --- a/tests/Basic/Basic.h +++ b/tests/Basic/Basic.h @@ -269,3 +269,12 @@ class HasIgnoredField Base fieldOfIgnoredType; }; +template +class DependentTypeWithNestedIndependent +{ + union + { + int i; + long l; + }; +};