summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/parser.c2
-rw-r--r--gcc/testsuite/ChangeLog3
-rw-r--r--gcc/testsuite/g++.dg/parse/cond4.C6
4 files changed, 14 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 8611d928dc8..10986b68c91 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,9 @@
2008-12-29 Jakub Jelinek <jakub@redhat.com>
+ PR c++/38635
+ * parser.c (cp_parser_condition): Use cp_parser_require
+ instead of cp_lexer_consume_token to consume =.
+
PR c++/38637
* decl.c (start_enum): If enumtype is error_mark_node, exit early.
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 400f36cc290..e21aa8e2ed9 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -7398,7 +7398,7 @@ cp_parser_condition (cp_parser* parser)
else
{
/* Consume the `='. */
- cp_lexer_consume_token (parser->lexer);
+ cp_parser_require (parser, CPP_EQ, "%<=%>");
initializer = cp_parser_initializer_clause (parser, &non_constant_p);
}
if (BRACE_ENCLOSED_INITIALIZER_P (initializer))
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 27649f02a80..24f7364d9c8 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,8 @@
2008-12-29 Jakub Jelinek <jakub@redhat.com>
+ PR c++/38635
+ * g++.dg/parse/cond4.C: New test.
+
PR c++/36191
* g++.dg/torture/pr36191.C: New test.
diff --git a/gcc/testsuite/g++.dg/parse/cond4.C b/gcc/testsuite/g++.dg/parse/cond4.C
new file mode 100644
index 00000000000..ae210e0d750
--- /dev/null
+++ b/gcc/testsuite/g++.dg/parse/cond4.C
@@ -0,0 +1,6 @@
+// PR c++/38635
+// { dg-do compile }
+
+void foo()
+{
+ if (struct A{}// { dg-error "types may not be defined|expected" }