From 094e1ec65a2df1b6e04dcc00ca63cfcc4dc474a8 Mon Sep 17 00:00:00 2001 From: Build Agent Date: Tue, 31 Mar 2020 16:26:52 +0100 Subject: [PATCH] Ensure typedefs of std::vector are mapped --- src/Generator/Types/Std/Stdlib.cs | 6 ++++-- tests/StandardLib/StandardLib.h | 4 ++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Generator/Types/Std/Stdlib.cs b/src/Generator/Types/Std/Stdlib.cs index c563c7c1..f3233510 100644 --- a/src/Generator/Types/Std/Stdlib.cs +++ b/src/Generator/Types/Std/Stdlib.cs @@ -489,7 +489,8 @@ namespace CppSharp.Types.Std public override void CLIMarshalToNative(MarshalContext ctx) { - var templateType = Type as TemplateSpecializationType; + var desugared = Type.Desugar(); + var templateType = desugared as TemplateSpecializationType; var type = templateType.Arguments[0].Type; var isPointerToPrimitive = type.Type.IsPointerToPrimitiveType(); var managedType = isPointerToPrimitive @@ -546,7 +547,8 @@ namespace CppSharp.Types.Std public override void CLIMarshalToManaged(MarshalContext ctx) { - var templateType = Type as TemplateSpecializationType; + var desugared = Type.Desugar(); + var templateType = desugared as TemplateSpecializationType; var type = templateType.Arguments[0].Type; var isPointerToPrimitive = type.Type.IsPointerToPrimitiveType(); var managedType = isPointerToPrimitive diff --git a/tests/StandardLib/StandardLib.h b/tests/StandardLib/StandardLib.h index 3220da3a..83102cd2 100644 --- a/tests/StandardLib/StandardLib.h +++ b/tests/StandardLib/StandardLib.h @@ -12,6 +12,8 @@ struct DLL_API IntWrapperValueType int Value; }; +typedef std::vector VectorTypedef; + struct DLL_API TestVectors { TestVectors(); @@ -28,6 +30,8 @@ struct DLL_API TestVectors std::vector IntWrapperPtrVector; // Should get mapped to List std::vector IntWrapperValueTypeVector; + // Should get mapped to List + VectorTypedef IntWrapperValueTypeVectorTypedef; }; struct DLL_API OStreamTest