From 444a6e639ff7a11760400e953e6403723f144dbb Mon Sep 17 00:00:00 2001 From: Dimitar Dobrev Date: Tue, 24 Sep 2013 23:09:24 +0300 Subject: [PATCH] Fixed the generation of fields of a type def type by correctly desugaring. Signed-off-by: Dimitar Dobrev --- src/Generator/Generators/CSharp/CSharpTypePrinter.cs | 5 +++-- tests/CSharpTemp/CSharpTemp.h | 11 +++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/Generator/Generators/CSharp/CSharpTypePrinter.cs b/src/Generator/Generators/CSharp/CSharpTypePrinter.cs index 78a6b6ea..6f382ebc 100644 --- a/src/Generator/Generators/CSharp/CSharpTypePrinter.cs +++ b/src/Generator/Generators/CSharp/CSharpTypePrinter.cs @@ -179,7 +179,8 @@ namespace CppSharp.Generators.CSharp return isManagedContext ? "string" : "global::System.IntPtr"; PrimitiveType primitive; - if (pointee.Desugar().IsPrimitiveType(out primitive)) + var desugared = pointee.Desugar(); + if (desugared.IsPrimitiveType(out primitive)) { if (isManagedContext && Context.Parameter != null && (Context.Parameter.IsOut || Context.Parameter.IsInOut)) @@ -191,7 +192,7 @@ namespace CppSharp.Generators.CSharp } Class @class; - if (pointee.IsTagDecl(out @class) + if (desugared.IsTagDecl(out @class) && ContextKind == CSharpTypePrinterContextKind.Native) { return "global::System.IntPtr"; diff --git a/tests/CSharpTemp/CSharpTemp.h b/tests/CSharpTemp/CSharpTemp.h index 1d62fa39..8ed8de8d 100644 --- a/tests/CSharpTemp/CSharpTemp.h +++ b/tests/CSharpTemp/CSharpTemp.h @@ -51,3 +51,14 @@ public: typedef void *Baz::*FunctionPointerResolvedAsVoidStar; operator FunctionPointerResolvedAsVoidStar() const { return 0; } }; + +struct QArrayData +{ +}; + +typedef QArrayData QByteArrayData; + +struct QByteArrayDataPtr +{ + QByteArrayData* ptr; +};