Merge pull request #5668 from kumpera/wasm-work-p4
[mono.git] / mcs / mcs / convert.cs
index a99e3fde628b60061aae8448ab3621c23a7fad9c..b11477c104394b7bc77075d6e4fa02827797529e 100644 (file)
@@ -736,8 +736,6 @@ namespace Mono.CSharp {
                        var tupleLiteralElements = (source as TupleLiteral)?.Elements;
 
                        for (int i = 0; i < targetType.Arity; ++i) {
-                               var elementType = srcTypeArgument [i];
-
                                if (tupleLiteralElements != null) {
                                        if (!ImplicitStandardConversionExists (tupleLiteralElements[i].Expr, targetTypeArgument [i])) {
                                                return false;
@@ -1505,6 +1503,11 @@ namespace Mono.CSharp {
                                        return null;
                        }
 
+                       if (expr is ReferenceExpression) {
+                               // Only identify conversion is allowed
+                               return null;
+                       }
+
                        e = ImplicitNumericConversion (expr, expr_type, target_type);
                        if (e != null)
                                return e;