@@ -556,11 +556,12 @@ public override bool VisitPointerType(PointerType pointer, TypeQualifiers quals)
556556 realPointer = templateSubstitution . Replacement . Type . Desugar ( ) as PointerType ;
557557 realPointer = realPointer ?? pointer ;
558558 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 )
562563 {
563- var refParamPtr = string . Format ( "__refParamPtr{0}" , Context . ParameterIndex ) ;
564+ var refParamPtr = $ "__refParamPtr{ Context . ParameterIndex } " ;
564565 if ( templateSubstitution != null )
565566 {
566567 var castParam = $ "__{ Context . Parameter . Name } { Context . ParameterIndex } ";
@@ -573,8 +574,9 @@ public override bool VisitPointerType(PointerType pointer, TypeQualifiers quals)
573574 Context . Before . Write ( "&" ) ;
574575 Context . Before . WriteLine ( $ "{ castParam } ;") ;
575576 Context . Return . Write ( refParamPtr ) ;
577+ return true ;
576578 }
577- else
579+ if ( Context . Function . OperatorKind != CXXOperatorKind . Subscript )
578580 {
579581 if ( Context . Parameter . Kind == ParameterKind . PropertyValue )
580582 {
@@ -588,8 +590,8 @@ public override bool VisitPointerType(PointerType pointer, TypeQualifiers quals)
588590 Context . Before . WriteStartBraceIndent ( ) ;
589591 Context . Return . Write ( refParamPtr ) ;
590592 }
593+ return true ;
591594 }
592- return true ;
593595 }
594596
595597 var param = Context . Parameter ;
0 commit comments