Fix character array indexing.
Fix character array indexing.
1.1 --- a/src/SemanticAnalysis.cpp Sun Aug 05 01:24:46 2012 -0700
1.2 +++ b/src/SemanticAnalysis.cpp Sun Aug 05 01:28:12 2012 -0700
1.3 @@ -1197,7 +1197,12 @@
1.4 cc_.reportError(node->left()->pos(), Message_IndexBaseMustBeArray);
1.5 return;
1.6 }
1.7 - node->setType(left->contained());
1.8 +
1.9 + // Note: char arrays are automatically up-casted to return an int32.
1.10 + if (left->isCharArray())
1.11 + node->setType(zone_->types()->getPrimitive(PrimitiveType_Int32));
1.12 + else
1.13 + node->setType(left->contained());
1.14 }
1.15
1.16 void