From 0753192b5bcb617b5edf5dfe53f34b40ec58c697 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Mon, 28 Mar 2011 22:58:49 +0000 Subject: [PATCH] Better error message for missing condition in if statement. From-SVN: r171638 --- gcc/go/gofrontend/parse.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gcc/go/gofrontend/parse.cc b/gcc/go/gofrontend/parse.cc index 1120c1e4827..c7cd1087b80 100644 --- a/gcc/go/gofrontend/parse.cc +++ b/gcc/go/gofrontend/parse.cc @@ -3779,6 +3779,12 @@ Parse::if_stat() if (!this->expression_may_start_here()) cond = Expression::make_error(this->location()); } + if (cond == NULL && this->peek_token()->is_op(OPERATOR_LCURLY)) + { + error_at(this->location(), + "missing condition in if statement"); + cond = Expression::make_error(this->location()); + } if (cond == NULL) cond = this->expression(PRECEDENCE_NORMAL, false, false, NULL); } -- 2.30.2