diff options
author | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-03-27 16:40:24 +0000 |
---|---|---|
committer | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-03-27 16:40:24 +0000 |
commit | 55661ce9639ecc7a94cac6820c0de76a2ef8319d (patch) | |
tree | 03766c118bbae97b5e8fb4e1fa4138f3c7fc1a39 | |
parent | 172c28f0dc209b64920455cfbdb91c6b23df328b (diff) | |
download | gcc-55661ce9639ecc7a94cac6820c0de76a2ef8319d.tar.gz |
Improve error about indirecting an unsafe.Pointer type.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@171574 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/go/gofrontend/expressions.cc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc index f1a2ec7cb55..3a6005138cd 100644 --- a/gcc/go/gofrontend/expressions.cc +++ b/gcc/go/gofrontend/expressions.cc @@ -3669,6 +3669,14 @@ Unary_expression::do_lower(Gogo*, Named_object*, int) } } + // Catching an invalid indirection of unsafe.Pointer here avoid + // having to deal with TYPE_VOID in other places. + if (op == OPERATOR_MULT && expr->type()->is_unsafe_pointer_type()) + { + error_at(this->location(), "invalid indirect of %<unsafe.Pointer%>"); + return Expression::make_error(this->location()); + } + if (op == OPERATOR_PLUS || op == OPERATOR_MINUS || op == OPERATOR_NOT || op == OPERATOR_XOR) { |