summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2013-10-15 16:36:11 +0000
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2013-10-15 16:36:11 +0000
commit444c104638ff28f2f6bd8d0bf186e1601ced8997 (patch)
treec4af60d10233b14ad5ff26eb9ae83f38709ceda0
parent1571aac7eceec92c4cdbd50818c3a57a1ebd0c2b (diff)
downloadgcc-444c104638ff28f2f6bd8d0bf186e1601ced8997.tar.gz
/cp
2013-10-15 Paolo Carlini <paolo.carlini@oracle.com> PR c++/58707 * parser.c (cp_parser_postfix_open_square_expression): Set parser->greater_than_is_operator_p for the argument. /testsuite 2013-10-15 Paolo Carlini <paolo.carlini@oracle.com> PR c++/58707 * g++.dg/cpp0x/pr58707.C: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@203624 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/parser.c6
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/pr58707.C6
4 files changed, 23 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index d1af38217bc..ed30e1bccbb 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2013-10-15 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/58707
+ * parser.c (cp_parser_postfix_open_square_expression): Set
+ parser->greater_than_is_operator_p for the argument.
+
2013-10-11 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/58633
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 4189bf6f117..e33f5a278ab 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -6231,10 +6231,14 @@ cp_parser_postfix_open_square_expression (cp_parser *parser,
{
tree index = NULL_TREE;
location_t loc = cp_lexer_peek_token (parser->lexer)->location;
+ bool saved_greater_than_is_operator_p;
/* Consume the `[' token. */
cp_lexer_consume_token (parser->lexer);
+ saved_greater_than_is_operator_p = parser->greater_than_is_operator_p;
+ parser->greater_than_is_operator_p = true;
+
/* Parse the index expression. */
/* ??? For offsetof, there is a question of what to allow here. If
offsetof is not being used in an integral constant expression context,
@@ -6278,6 +6282,8 @@ cp_parser_postfix_open_square_expression (cp_parser *parser,
index = cp_parser_expression (parser, /*cast_p=*/false, NULL);
}
+ parser->greater_than_is_operator_p = saved_greater_than_is_operator_p;
+
/* Look for the closing `]'. */
cp_parser_require (parser, CPP_CLOSE_SQUARE, RT_CLOSE_SQUARE);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 1cbcfdca003..f290da8ac78 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2013-10-15 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/58707
+ * g++.dg/cpp0x/pr58707.C: New.
+
2013-10-15 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
* c-c++-common/cpp/openmp-define-3.c: Move effective target check
diff --git a/gcc/testsuite/g++.dg/cpp0x/pr58707.C b/gcc/testsuite/g++.dg/cpp0x/pr58707.C
new file mode 100644
index 00000000000..12f2e309788
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/pr58707.C
@@ -0,0 +1,6 @@
+// PR c++/58707
+// { dg-do compile { target c++11 } }
+
+template<int i> class TC { };
+constexpr int foo[] = { 42 };
+TC<foo[0 > 1]> bar;