diff options
author | Ian Lance Taylor <iant@google.com> | 2012-12-04 06:44:19 +0000 |
---|---|---|
committer | Ian Lance Taylor <iant@google.com> | 2012-12-04 06:44:19 +0000 |
commit | 1be8324f03890525ca5e5320e86ab6af1fb882b0 (patch) | |
tree | 64966e7210e3f5894aeff8abf63af39dfe1d22d2 | |
parent | a46a0552ff40180f2a1803dcb803bedc7d9ec542 (diff) |
compiler: Reject invalid nil == nil comparisons.
git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@194119 138bc75d-0d04-0410-961f-82ee72b054a4
-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 bfc1b625d71..e0690e77bf6 100644 --- a/gcc/go/gofrontend/expressions.cc +++ b/gcc/go/gofrontend/expressions.cc @@ -5610,6 +5610,11 @@ Binary_expression::do_check_types(Gogo*) || this->op_ == OPERATOR_GT || this->op_ == OPERATOR_GE) { + if (left_type->is_nil_type() && right_type->is_nil_type()) + { + this->report_error(_("invalid comparison of nil with nil")); + return; + } if (!Type::are_assignable(left_type, right_type, NULL) && !Type::are_assignable(right_type, left_type, NULL)) { |