OSDN Git Service

Don't crash on attempt to index array type expression.
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 22 Feb 2011 03:16:38 +0000 (03:16 +0000)
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 22 Feb 2011 03:16:38 +0000 (03:16 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@170387 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/go/gofrontend/expressions.cc

index 8b064e6..b58792c 100644 (file)
@@ -9034,6 +9034,11 @@ Index_expression::do_lower(Gogo*, Named_object*, int)
   Type* type = left->type();
   if (type->is_error_type())
     return Expression::make_error(location);
+  else if (left->is_type_expression())
+    {
+      error_at(location, "attempt to index type expression");
+      return Expression::make_error(location);
+    }
   else if (type->array_type() != NULL)
     return Expression::make_array_index(left, start, end, location);
   else if (type->points_to() != NULL