From 15ea09a082e6964a4abbc49a6834cf5ab705813a Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Sun, 27 Mar 2011 16:40:24 +0000 Subject: [PATCH] Improve error about indirecting an unsafe.Pointer type. From-SVN: r171574 --- gcc/go/gofrontend/expressions.cc | 8 ++++++++ 1 file changed, 8 insertions(+) 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 %"); + return Expression::make_error(this->location()); + } + if (op == OPERATOR_PLUS || op == OPERATOR_MINUS || op == OPERATOR_NOT || op == OPERATOR_XOR) { -- 2.30.2