Commit 5f83e90b by Jason Merrill Committed by Jason Merrill

re PR c++/63455 (decltype of statement expression internal compiler error: in…

re PR c++/63455 (decltype of statement expression  internal compiler error: in cp_parser_abort_tentative_parse, at cp/parser.c:25062)

	PR c++/63455
c-family/
	* c-common.h (CPP_PREPARSED_EXPR): New.
	(N_CP_TTYPES): Adjust.
cp/
	* parser.c (struct saved_token_sentinel): New.
	(cp_parser_statement): Use it.
	(cp_parser_start_tentative_firewall): New.
	(cp_parser_end_tentative_firewall): New.
	(cp_parser_lambda_expression): Use them.
	(cp_parser_statement_expr): New.
	(cp_parser_primary_expression): Use it.

From-SVN: r216260
parent 327a79a5
2014-10-14 Jason Merrill <jason@redhat.com>
PR c++/63455
* c-common.h (CPP_PREPARSED_EXPR): New.
(N_CP_TTYPES): Adjust.
2014-10-15 Marek Polacek <polacek@redhat.com>
* c-opts.c (c_common_init_options): Make -std=gnu11 the default for C.
......
......@@ -361,8 +361,11 @@ struct c_common_resword
/* A token type for pre-parsed C++0x decltype. */
#define CPP_DECLTYPE ((enum cpp_ttype) (CPP_NESTED_NAME_SPECIFIER + 1))
/* A token type for pre-parsed primary-expression (lambda- or statement-). */
#define CPP_PREPARSED_EXPR ((enum cpp_ttype) (CPP_DECLTYPE + 1))
/* The number of token types, including C++-specific ones. */
#define N_CP_TTYPES ((int) (CPP_DECLTYPE + 1))
#define N_CP_TTYPES ((int) (CPP_PREPARSED_EXPR + 1))
/* Disable mask. Keywords are disabled if (reswords[i].disable &
mask) is _true_. Thus for keywords which are present in all
......
2014-10-14 Jason Merrill <jason@redhat.com>
PR c++/63455
* parser.c (struct saved_token_sentinel): New.
(cp_parser_statement): Use it.
(cp_parser_start_tentative_firewall): New.
(cp_parser_end_tentative_firewall): New.
(cp_parser_lambda_expression): Use them.
(cp_parser_statement_expr): New.
(cp_parser_primary_expression): Use it.
2014-10-14 DJ Delorie <dj@redhat.com>
* typeck.c (cp_common_type): Check for all __intN types, not just
......
......@@ -8,9 +8,9 @@ struct AddRvalueReferenceImpl { typedef T type; };
template <typename T>
struct AddRvalueReferenceImpl<T, typename BoolSink<false &&
[] {
[] { // { dg-error "lambda" }
extern T &&tref;
}>::type> { // { dg-error "lambda" }
}>::type> {
typedef T &&type;
};
......@@ -27,9 +27,9 @@ struct IsConstructibleImpl { enum { value = 0 }; };
template <typename T, typename ...Args>
struct IsConstructibleImpl<T, typename BoolSink<false &&
[] {
[] { // { dg-error "lambda" }
T t( ::ImplHelpers::create<Args>() ...);
}>::type, Args ...> { // { dg-error "lambda" }
}>::type, Args ...> {
enum { value = 1 };
};
......@@ -53,3 +53,4 @@ static_assert(+IsConstructible<int &&, int &&>::value, "error");
// { dg-prune-output "expected" }
// { dg-prune-output "does not name a class" }
// { dg-prune-output "static assertion" }
// { dg-prune-output "template argument . is invalid" }
// PR c++/63455
// { dg-options "-std=gnu++11" }
int main()
{
int x = 0;
// without '+0', gcc 4.6 gives a different error (no ICE though)
decltype(({ int y = x; y; })+0) v1 = 0;
}
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