diff --git a/src/Generator/Generators/CSharp/CSharpTypePrinter.cs b/src/Generator/Generators/CSharp/CSharpTypePrinter.cs index a222a94e..9c43d37b 100644 --- a/src/Generator/Generators/CSharp/CSharpTypePrinter.cs +++ b/src/Generator/Generators/CSharp/CSharpTypePrinter.cs @@ -140,11 +140,9 @@ namespace CppSharp.Generators.CSharp { var pointee = pointer.Pointee.Desugar(); - if (pointee.IsPrimitiveType(PrimitiveType.Char) && - pointer.QualifiedPointee.Qualifiers.IsConst) - return true; - - return false; + return (pointee.IsPrimitiveType(PrimitiveType.Char) || + pointee.IsPrimitiveType(PrimitiveType.WideChar)) && + pointer.QualifiedPointee.Qualifiers.IsConst; } public static bool IsConstCharString(QualifiedType qualType) diff --git a/tests/Basic/Basic.cpp b/tests/Basic/Basic.cpp index a45acbed..4650dc56 100644 --- a/tests/Basic/Basic.cpp +++ b/tests/Basic/Basic.cpp @@ -76,6 +76,11 @@ int unsafeFunction(const Bar& ret, char* testForString, void (*foo)(int)) return ret.A; } +const wchar_t* wcharFunction(const wchar_t* constWideChar) +{ + return constWideChar; +} + Bar operator+(const Bar& b1, const Bar& b2) { Bar b;