diff options
author | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-12-04 00:28:30 +0000 |
---|---|---|
committer | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-12-04 00:28:30 +0000 |
commit | 55dcfde90c2dc80a5832596aef876844b876f3dd (patch) | |
tree | 7aab56d0949781e1d6418ddb66d3581e3bb2b396 | |
parent | a6bad88e869dc880c29234f9bee7585cca7d1cbb (diff) | |
download | gcc-55dcfde90c2dc80a5832596aef876844b876f3dd.tar.gz |
compiler: Don't permit go/defer argument to be parenthesized.
Fixes Go repository issue 4468.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@194112 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/go/gofrontend/parse.cc | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/gcc/go/gofrontend/parse.cc b/gcc/go/gofrontend/parse.cc index fe463c7d66f..c13f06b9495 100644 --- a/gcc/go/gofrontend/parse.cc +++ b/gcc/go/gofrontend/parse.cc @@ -4089,13 +4089,16 @@ Parse::go_or_defer_stat() || this->peek_token()->is_keyword(KEYWORD_DEFER)); bool is_go = this->peek_token()->is_keyword(KEYWORD_GO); Location stat_location = this->location(); - this->advance_token(); + + const Token* token = this->advance_token(); Location expr_location = this->location(); + bool is_parenthesized = token->is_op(OPERATOR_LPAREN); + Expression* expr = this->expression(PRECEDENCE_NORMAL, false, true, NULL); Call_expression* call_expr = expr->call_expression(); - if (call_expr == NULL) + if (is_parenthesized || call_expr == NULL) { - error_at(expr_location, "expected call expression"); + error_at(expr_location, "argument to go/defer must be function call"); return; } |