diff --git a/ICSharpCode.Decompiler/CSharp/ExpressionBuilder.cs b/ICSharpCode.Decompiler/CSharp/ExpressionBuilder.cs index 47f85be38..79a9c2586 100644 --- a/ICSharpCode.Decompiler/CSharp/ExpressionBuilder.cs +++ b/ICSharpCode.Decompiler/CSharp/ExpressionBuilder.cs @@ -277,10 +277,15 @@ namespace ICSharpCode.Decompiler.CSharp } argument = argument.ConvertTo(compatibleType, this); - return new UnaryOperatorExpression(UnaryOperatorType.BitNot, argument) - .WithRR(new OperatorResolveResult(compatibleType, ExpressionType.Not, argument.ResolveResult)) - .WithILInstruction(inst) - .ConvertTo(type, this); + var rr = resolver.ResolveUnaryOperator(UnaryOperatorType.BitNot, argument.ResolveResult); + var result = new UnaryOperatorExpression(UnaryOperatorType.BitNot, argument) + .WithRR(rr) + .WithILInstruction(inst); + if (type != null && (type.KnownTypeCode == KnownTypeCode.IntPtr || type.KnownTypeCode == KnownTypeCode.UIntPtr)) { + return result.ConvertTo(type, this); + } else { + return result; + } } ExpressionWithResolveResult LogicNot(TranslatedExpression expr) diff --git a/NRefactory b/NRefactory index f89093760..1463cf299 160000 --- a/NRefactory +++ b/NRefactory @@ -1 +1 @@ -Subproject commit f89093760da14a6f1c42161d0428c990434d1ecd +Subproject commit 1463cf299d05a80d1056ad6608c375688629f006