From 4e91f3777a14c1ce425674e0c2dd42c34b42d7a8 Mon Sep 17 00:00:00 2001 From: Matt Pharr Date: Fri, 23 Sep 2011 15:19:14 -0700 Subject: [PATCH] Fix BinaryExpr to handle reference-typed operands. Fixes issue #101. --- expr.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/expr.cpp b/expr.cpp index 6697236a..22b2f0cc 100644 --- a/expr.cpp +++ b/expr.cpp @@ -1305,6 +1305,17 @@ BinaryExpr::TypeCheck() { if (type0 == NULL || type1 == NULL) return NULL; + if (dynamic_cast(type0) != NULL) { + arg0 = new DereferenceExpr(arg0, arg0->pos); + type0 = arg0->GetType(); + assert(type0 != NULL); + } + if (dynamic_cast(type1) != NULL) { + arg1 = new DereferenceExpr(arg1, arg1->pos); + type1 = arg1->GetType(); + assert(type1 != NULL); + } + switch (op) { case Shl: case Shr: