Skip to content

Commit 2d57c78

Browse files
committed
Fixed generation support for pointers to enums in C#.
Fixes #1093.
1 parent 2a53e07 commit 2d57c78

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

src/Generator/Generators/CSharp/CSharpTypePrinter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ public override TypePrinterResult VisitFunctionType(FunctionType function,
182182
public override TypePrinterResult VisitPointerType(PointerType pointer,
183183
TypeQualifiers quals)
184184
{
185-
if (MarshalKind == MarshalKind.NativeField)
185+
if (MarshalKind == MarshalKind.NativeField && !pointer.Pointee.IsEnumType())
186186
return IntPtrType;
187187

188188
if (pointer.Pointee is FunctionType)

tests/CSharp/CSharp.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,14 @@ int TestRenaming::property()
430430
return 1;
431431
}
432432

433+
UsesPointerToEnum::UsesPointerToEnum()
434+
{
435+
}
436+
437+
void UsesPointerToEnum::hasPointerToEnumInParam(Flags* flag)
438+
{
439+
}
440+
433441
UsesPointerToEnumInParamOfVirtual::UsesPointerToEnumInParamOfVirtual()
434442
{
435443
}

tests/CSharp/CSharp.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,14 @@ enum class Flags
298298
Flag3 = 4
299299
};
300300

301+
class DLL_API UsesPointerToEnum
302+
{
303+
public:
304+
UsesPointerToEnum();
305+
Flags* _flags;
306+
void hasPointerToEnumInParam(Flags* flag);
307+
};
308+
301309
class DLL_API UsesPointerToEnumInParamOfVirtual
302310
{
303311
public:

0 commit comments

Comments
 (0)