Commit 67f01839 by Paolo Carlini

re PR c++/51908 ([C++11] ICE in cp_parser_abort_tentative_parse with decltype…

re PR c++/51908 ([C++11] ICE in cp_parser_abort_tentative_parse with decltype and variable template arguments)

/cp
2013-06-05  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/51908
	* parser.c (cp_parser_postfix_expression [RID_*CAST]): Set
	parser->in_type_id_in_expr_p before calling cp_parser_type_id.

/testsuite
2013-06-05  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/51908
	* g++.dg/cpp0x/decltype54.C: New.

From-SVN: r199707
parent 17a7fc37
2013-06-05 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/51908
* parser.c (cp_parser_postfix_expression [RID_*CAST]): Set
parser->in_type_id_in_expr_p before calling cp_parser_type_id.
2013-06-03 Jan Hubicka <jh@suse.cz> 2013-06-03 Jan Hubicka <jh@suse.cz>
* decl2.c (maybe_make_one_only): Use forced_by_abi instad of * decl2.c (maybe_make_one_only): Use forced_by_abi instead of
mark_decl_referenced. mark_decl_referenced.
(mark_needed): Likewise. (mark_needed): Likewise.
......
...@@ -5546,6 +5546,7 @@ cp_parser_postfix_expression (cp_parser *parser, bool address_p, bool cast_p, ...@@ -5546,6 +5546,7 @@ cp_parser_postfix_expression (cp_parser *parser, bool address_p, bool cast_p,
tree type; tree type;
tree expression; tree expression;
const char *saved_message; const char *saved_message;
bool saved_in_type_id_in_expr_p;
/* All of these can be handled in the same way from the point /* All of these can be handled in the same way from the point
of view of parsing. Begin by consuming the token of view of parsing. Begin by consuming the token
...@@ -5560,7 +5561,10 @@ cp_parser_postfix_expression (cp_parser *parser, bool address_p, bool cast_p, ...@@ -5560,7 +5561,10 @@ cp_parser_postfix_expression (cp_parser *parser, bool address_p, bool cast_p,
/* Look for the opening `<'. */ /* Look for the opening `<'. */
cp_parser_require (parser, CPP_LESS, RT_LESS); cp_parser_require (parser, CPP_LESS, RT_LESS);
/* Parse the type to which we are casting. */ /* Parse the type to which we are casting. */
saved_in_type_id_in_expr_p = parser->in_type_id_in_expr_p;
parser->in_type_id_in_expr_p = true;
type = cp_parser_type_id (parser); type = cp_parser_type_id (parser);
parser->in_type_id_in_expr_p = saved_in_type_id_in_expr_p;
/* Look for the closing `>'. */ /* Look for the closing `>'. */
cp_parser_require (parser, CPP_GREATER, RT_GREATER); cp_parser_require (parser, CPP_GREATER, RT_GREATER);
/* Restore the old message. */ /* Restore the old message. */
......
2013-06-05 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/51908
* g++.dg/cpp0x/decltype54.C: New.
2013-06-05 James Greenhalgh <james.greenhalgh@arm.com> 2013-06-05 James Greenhalgh <james.greenhalgh@arm.com>
* gcc.dg/fshort-wchar.c: Add extra dg-options for * gcc.dg/fshort-wchar.c: Add extra dg-options for
......
// PR c++/51908
// { dg-do compile { target c++11 } }
struct foo1
{
template <typename Ret, typename... Args>
operator decltype(static_cast<Ret (*)(Args...)>(nullptr)) () const;
};
struct foo2
{
template <typename Ret, typename... Args>
operator decltype(static_cast<Ret (*)(Args... args)>(nullptr)) () const;
};
struct foo3
{
template <typename Ret, typename Arg>
operator decltype(static_cast<Ret (*)(Arg)>(nullptr)) () const;
};
struct foo4
{
template <typename Ret, typename Arg>
operator decltype(static_cast<Ret (*)(Arg arg)>(nullptr)) () const;
};
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