diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2011-02-22 03:16:38 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2011-02-22 03:16:38 +0000 |
commit | d18c88a8438e0404530aecca69173b18d0f4f992 (patch) | |
tree | 9d6f95368e57990b1b1dde0c1c9ba3f9e80e2897 /gcc | |
parent | 48347769a17adb6e8fc67eafb36da3a06ca311e2 (diff) | |
download | gcc-d18c88a8438e0404530aecca69173b18d0f4f992.zip gcc-d18c88a8438e0404530aecca69173b18d0f4f992.tar.gz gcc-d18c88a8438e0404530aecca69173b18d0f4f992.tar.bz2 |
Don't crash on attempt to index array type expression.
From-SVN: r170387
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/go/gofrontend/expressions.cc | 5 |
1 files changed, 5 insertions, 0 deletions
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 |