From 011cdf2ae6479c0fe630895346125f33c953bcc8 Mon Sep 17 00:00:00 2001 From: Dimitar Dobrev Date: Thu, 30 Oct 2014 19:30:41 +0200 Subject: [PATCH] Fixed invalid code generated for typedef pointer params by the C++/CLI back-end. Signed-off-by: Dimitar Dobrev --- src/Generator/Generators/CLI/CLIMarshal.cs | 2 +- tests/Basic/Basic.cpp | 4 ++++ tests/Basic/Basic.h | 4 ++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Generator/Generators/CLI/CLIMarshal.cs b/src/Generator/Generators/CLI/CLIMarshal.cs index b656628b..b4513956 100644 --- a/src/Generator/Generators/CLI/CLIMarshal.cs +++ b/src/Generator/Generators/CLI/CLIMarshal.cs @@ -623,7 +623,7 @@ namespace CppSharp.Generators.CLI return; } - if (!Context.Parameter.Type.SkipPointerRefs().IsPointer()) + if (!Context.Parameter.Type.Desugar().SkipPointerRefs().IsPointer()) { Context.Return.Write("*"); diff --git a/tests/Basic/Basic.cpp b/tests/Basic/Basic.cpp index 3491e0af..3247899e 100644 --- a/tests/Basic/Basic.cpp +++ b/tests/Basic/Basic.cpp @@ -19,6 +19,10 @@ const char* Foo::GetANSI() return "ANSI"; } +void Foo::TakesTypedefedPtr(FooPtr date) +{ +} + Foo2::Foo2() {} Foo2 Foo2::operator<<(signed int i) diff --git a/tests/Basic/Basic.h b/tests/Basic/Basic.h index 7c875d52..8cb9485f 100644 --- a/tests/Basic/Basic.h +++ b/tests/Basic/Basic.h @@ -39,6 +39,10 @@ public: // Primitive pointer types const int* SomePointer; const int** SomePointerPointer; + + typedef Foo* FooPtr; + + void TakesTypedefedPtr(FooPtr date); }; struct DLL_API Bar