@@ -556,11 +556,12 @@ public override bool VisitPointerType(PointerType pointer, TypeQualifiers quals)
556
556
realPointer = templateSubstitution . Replacement . Type . Desugar ( ) as PointerType ;
557
557
realPointer = realPointer ?? pointer ;
558
558
var pointee = pointer . Pointee . Desugar ( ) ;
559
- if ( Context . Function != null && realPointer . IsPrimitiveTypeConvertibleToRef ( ) &&
560
- Context . MarshalKind != MarshalKind . VTableReturnValue &&
561
- Context . Function . OperatorKind != CXXOperatorKind . Subscript )
559
+ if ( Context . Function != null &&
560
+ ( realPointer . IsPrimitiveTypeConvertibleToRef ( ) ||
561
+ ( templateSubstitution != null && realPointer . Pointee . IsEnumType ( ) ) ) &&
562
+ Context . MarshalKind != MarshalKind . VTableReturnValue )
562
563
{
563
- var refParamPtr = string . Format ( "__refParamPtr{0}" , Context . ParameterIndex ) ;
564
+ var refParamPtr = $ "__refParamPtr{ Context . ParameterIndex } " ;
564
565
if ( templateSubstitution != null )
565
566
{
566
567
var castParam = $ "__{ Context . Parameter . Name } { Context . ParameterIndex } ";
@@ -573,8 +574,9 @@ public override bool VisitPointerType(PointerType pointer, TypeQualifiers quals)
573
574
Context . Before . Write ( "&" ) ;
574
575
Context . Before . WriteLine ( $ "{ castParam } ;") ;
575
576
Context . Return . Write ( refParamPtr ) ;
577
+ return true ;
576
578
}
577
- else
579
+ if ( Context . Function . OperatorKind != CXXOperatorKind . Subscript )
578
580
{
579
581
if ( Context . Parameter . Kind == ParameterKind . PropertyValue )
580
582
{
@@ -588,8 +590,8 @@ public override bool VisitPointerType(PointerType pointer, TypeQualifiers quals)
588
590
Context . Before . WriteStartBraceIndent ( ) ;
589
591
Context . Return . Write ( refParamPtr ) ;
590
592
}
593
+ return true ;
591
594
}
592
- return true ;
593
595
}
594
596
595
597
var param = Context . Parameter ;
0 commit comments