From a7799edb14029ad8352c5115d0450dfaf41fb2f5 Mon Sep 17 00:00:00 2001 From: Dimitar Dobrev Date: Mon, 15 Jun 2015 21:10:15 +0300 Subject: [PATCH] Fixed a bug when having a field with a protected ignored type. Signed-off-by: Dimitar Dobrev --- src/Generator/Generators/CSharp/CSharpTextTemplate.cs | 2 ++ tests/CSharpTemp/CSharpTemp.h | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/src/Generator/Generators/CSharp/CSharpTextTemplate.cs b/src/Generator/Generators/CSharp/CSharpTextTemplate.cs index 9f0eaffe..003f5078 100644 --- a/src/Generator/Generators/CSharp/CSharpTextTemplate.cs +++ b/src/Generator/Generators/CSharp/CSharpTextTemplate.cs @@ -646,6 +646,8 @@ namespace CppSharp.Generators.CSharp public void GenerateClassProlog(Class @class) { Write(@class.IsInternal ? "internal " : Helpers.GetAccess(@class.Access)); + if (@class.Access == AccessSpecifier.Protected) + Write("internal "); Write("unsafe "); if (Driver.Options.GenerateAbstractImpls && @class.IsAbstract) diff --git a/tests/CSharpTemp/CSharpTemp.h b/tests/CSharpTemp/CSharpTemp.h index 4763b28a..27a52619 100644 --- a/tests/CSharpTemp/CSharpTemp.h +++ b/tests/CSharpTemp/CSharpTemp.h @@ -468,3 +468,13 @@ private: HasVirtualDtor2* hasVirtualDtor2; Bar* bar; }; + +class HasProtectedNestedAnonymousType +{ +protected: + union + { + int i; + double d; + } u; +};