stage3/narrow_candidate_datatypes.cc
changeset 919 8da635655f37
parent 910 a0518971127d
child 933 76324f461aed
--- a/stage3/narrow_candidate_datatypes.cc	Tue Jul 29 13:39:40 2014 +0100
+++ b/stage3/narrow_candidate_datatypes.cc	Thu Jul 31 17:49:44 2014 +0100
@@ -1412,7 +1412,10 @@
 				l_expr->datatype = l_type;
 				r_expr->datatype = r_type;
 				count ++;
-			} else if ((l_type == r_type) && get_datatype_info_c::is_enumerated(l_type) && get_datatype_info_c::is_BOOL_compatible(symbol->datatype)) {
+			} else if (   /* handle the special case of enumerations */
+			              (get_datatype_info_c::is_BOOL_compatible(symbol->datatype) && get_datatype_info_c::is_enumerated(l_type) && (l_type == r_type))
+			              /* handle the special case of comparison between REF_TO datatypes */
+			           || (get_datatype_info_c::is_BOOL_compatible(symbol->datatype) && get_datatype_info_c::is_ref_to    (l_type) && get_datatype_info_c::is_type_equal(l_type, r_type))) {
 				if (NULL != deprecated_operation)  *deprecated_operation = false;
 				l_expr->datatype = l_type;
 				r_expr->datatype = r_type;