Commit 478a716a by Jason Merrill Committed by Jason Merrill

re PR c++/37875 ([c++0x] misinterpreted closing angle bracket in decltype operand)

	PR c++/37875
	* parser.c (cp_parser_decltype): Set greater_than_is_operator_p.

From-SVN: r152686
parent 23f392e0
2009-10-12 Jason Merrill <jason@redhat.com> 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 PR c++/37766
* pt.c (type_unification_real): Call convert_template_argument * pt.c (type_unification_real): Call convert_template_argument
for function default template arguments. for function default template arguments.
......
...@@ -9541,12 +9541,25 @@ cp_parser_decltype (cp_parser *parser) ...@@ -9541,12 +9541,25 @@ cp_parser_decltype (cp_parser *parser)
cp_parser_parse_definitely (parser); cp_parser_parse_definitely (parser);
else else
{ {
bool saved_greater_than_is_operator_p;
/* Abort our attempt to parse an id-expression or member access /* Abort our attempt to parse an id-expression or member access
expression. */ expression. */
cp_parser_abort_tentative_parse (parser); 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. */ /* Parse a full expression. */
expr = cp_parser_expression (parser, /*cast_p=*/false, NULL); 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. */ /* Go back to evaluating expressions. */
......
2009-10-12 Jason Merrill <jason@redhat.com> 2009-10-12 Jason Merrill <jason@redhat.com>
PR c++/37875
* g++.dg/cpp0x/decltype18.C: New.
PR c++/37766 PR c++/37766
* g++.dg/cpp0x/fntmpdefarg1.C: New. * g++.dg/cpp0x/fntmpdefarg1.C: New.
......
// PR c++/37875
// { dg-options "-std=c++0x" }
template <typename> struct X {};
X<decltype(1 > 2)> x;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment