diff options
-rw-r--r-- | gcc/cp/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/cp/parser.c | 13 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/decltype18.C | 5 |
4 files changed, 24 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 07dc96a..7765c73 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2009-10-12 Jason Merrill <jason@redhat.com> + PR c++/37875 + * parser.c (cp_parser_decltype): Set greater_than_is_operator_p. + PR c++/37766 * pt.c (type_unification_real): Call convert_template_argument for function default template arguments. diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 44dceb2..5e37343 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -9541,12 +9541,25 @@ cp_parser_decltype (cp_parser *parser) cp_parser_parse_definitely (parser); else { + bool saved_greater_than_is_operator_p; + /* Abort our attempt to parse an id-expression or member access expression. */ cp_parser_abort_tentative_parse (parser); + /* Within a parenthesized expression, a `>' token is always + the greater-than operator. */ + saved_greater_than_is_operator_p + = parser->greater_than_is_operator_p; + parser->greater_than_is_operator_p = true; + /* Parse a full expression. */ expr = cp_parser_expression (parser, /*cast_p=*/false, NULL); + + /* The `>' token might be the end of a template-id or + template-parameter-list now. */ + parser->greater_than_is_operator_p + = saved_greater_than_is_operator_p; } /* Go back to evaluating expressions. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e9ca25b..32b2ea4 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2009-10-12 Jason Merrill <jason@redhat.com> + PR c++/37875 + * g++.dg/cpp0x/decltype18.C: New. + PR c++/37766 * g++.dg/cpp0x/fntmpdefarg1.C: New. diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype18.C b/gcc/testsuite/g++.dg/cpp0x/decltype18.C new file mode 100644 index 0000000..0d44586 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/decltype18.C @@ -0,0 +1,5 @@ +// PR c++/37875 +// { dg-options "-std=c++0x" } + +template <typename> struct X {}; +X<decltype(1 > 2)> x; |