From b0cf7ddda65f753aab9979bc1ac0fe86eb6d8d25 Mon Sep 17 00:00:00 2001 From: ian Date: Tue, 22 Feb 2011 03:16:38 +0000 Subject: [PATCH] Don't crash on attempt to index array type expression. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@170387 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/go/gofrontend/expressions.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc index 8b064e6..b58792c 100644 --- a/gcc/go/gofrontend/expressions.cc +++ b/gcc/go/gofrontend/expressions.cc @@ -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 -- 2.7.4