Hi,

Here is a trivial patch to fix a crash which I discovered when trying to
stress the parser.  Unary expressions '& 1' and '* 1' (AddressOf and
Indirect) currently crash mcs when it tries to perform constant
folding.  Shall I apply to CVS?  

Andrew
(new email address, btw)

Index: expression.cs
===================================================================
RCS file: /cvs/public/mcs/mcs/expression.cs,v
retrieving revision 1.306
diff -u -r1.306 expression.cs
--- expression.cs       24 Jul 2002 22:56:44 -0000      1.306
+++ expression.cs       27 Jul 2002 10:13:53 -0000
@@ -236,8 +236,14 @@
 
                                Error23 (expr_type);
                                return null;
+
+                       case Operator.AddressOf:
+                               return e;
+
+                       case Operator.Indirection:
+                               return e;
                        }
-                       throw new Exception ("Can not constant fold");
+                       throw new Exception ("Can not constant fold: " + 
+Oper.ToString());
                }
 
                Expression ResolveOperator (EmitContext ec)

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to