From: Chris Lattner Date: Sun, 22 Jul 2007 04:13:33 +0000 (+0000) Subject: Catch goto's with a missing identifier, patch by Neil Booth. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=95cfb85ad1820117e0864712555f3aa4fdf4721a;p=clang Catch goto's with a missing identifier, patch by Neil Booth. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40381 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/Parse/ParseStmt.cpp b/Parse/ParseStmt.cpp index 27c1fa88a1..564b09722f 100644 --- a/Parse/ParseStmt.cpp +++ b/Parse/ParseStmt.cpp @@ -680,7 +680,11 @@ Parser::StmtResult Parser::ParseGotoStatement() { return true; } Res = Actions.ParseIndirectGotoStmt(GotoLoc, StarLoc, R.Val); + } else { + Diag(Tok, diag::err_expected_ident); + return true; } + return Res; } diff --git a/test/Parser/goto-ident.c b/test/Parser/goto-ident.c new file mode 100644 index 0000000000..0dc7f4ec40 --- /dev/null +++ b/test/Parser/goto-ident.c @@ -0,0 +1,6 @@ +/* RUN: clang -parse-ast-check %s +*/ + +void foo() { + goto ; /* expected-error {{expected identifier}} */ +}