summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/parse-else-error-2.c
diff options
context:
space:
mode:
authormanu <manu@138bc75d-0d04-0410-961f-82ee72b054a4>2007-11-26 19:01:54 +0000
committermanu <manu@138bc75d-0d04-0410-961f-82ee72b054a4>2007-11-26 19:01:54 +0000
commit10c93a350ac625f7e49f1aa87d4b2838ead89f43 (patch)
tree3aa88863b57e5e2d234313c7a65fb6d464e0d2ee /gcc/testsuite/gcc.dg/parse-else-error-2.c
parent64f91bdc6c66b1bc7b832cb4cb296ed424f1867c (diff)
downloadgcc-10c93a350ac625f7e49f1aa87d4b2838ead89f43.tar.gz
2007-11-26 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
PR c/23722 * c-parser.c (struct c_parser): New bit in_if_block. (c_parser_compound_statement_nostart): Handle unexpected 'else' keyword. (c_parser_statement_after_labels): Set in_if_block to false while parsing. (c_parser_if_body): Don't call c_parser_statement_after_labels if a semicolon is found, just consume it. Don't call c_parser_statement_after_labels if an open brace is found, call c_parser_compound_statement instead. (c_parser_else_body): New. (c_parser_if_statement): Set in_if_block to true when parsing the body of the 'if' statement. Use c_parser_else_body. testsuite/ * gcc.dg/cpp/19990413-1.c: Update. * gcc.dg/parse-else-error.c: New. * gcc.dg/parse-else-error-2.c: New. * gcc.dg/parse-else-error-3.c: New. * gcc.dg/parse-else-error-4.c: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@130446 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.dg/parse-else-error-2.c')
-rw-r--r--gcc/testsuite/gcc.dg/parse-else-error-2.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/parse-else-error-2.c b/gcc/testsuite/gcc.dg/parse-else-error-2.c
new file mode 100644
index 00000000000..ce59af3813e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/parse-else-error-2.c
@@ -0,0 +1,13 @@
+/* PR 23722 */
+/* { dg-do compile } */
+/* { dg-options "-fsyntax-only" } */
+int f()
+{
+ if (1)
+ {
+ return 1;
+ else /* { dg-error "expected .\}. before 'else'" } */
+ {
+ }
+ }
+} /* { dg-error "expected identifier or '\\(' before .\}. token" } */