From f28db2f5f1ab502857a89fe78391ecfd6fc90d6f Mon Sep 17 00:00:00 2001 From: triton Date: Wed, 23 Jan 2013 10:19:36 +0000 Subject: [PATCH] Add an explicit cast when we have a typedef to a primitive type. This fixes some ambiguity cases when the compiler later performs overload resolution. --- src/Generator/Generators/CLI/CLIMarshal.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Generator/Generators/CLI/CLIMarshal.cs b/src/Generator/Generators/CLI/CLIMarshal.cs index f2546c3a..415016c9 100644 --- a/src/Generator/Generators/CLI/CLIMarshal.cs +++ b/src/Generator/Generators/CLI/CLIMarshal.cs @@ -353,12 +353,18 @@ namespace Cxxi.Generators.CLI } FunctionType func; - if (typedef.Declaration.Type.IsPointerTo(out func)) + if (decl.Type.IsPointerTo(out func)) { VisitDelegateType(func, typedef.Declaration.OriginalName); return true; } + PrimitiveType primitive; + if (decl.Type.IsPrimitiveType(out primitive, walkTypedefs: true)) + { + Return += string.Format("({0})", typedef.Declaration.Name); + } + return decl.Type.Visit(this); }