Commit efcf217b by Jason Merrill Committed by Jason Merrill

re PR c++/56646 (ICE: in cp_parser_late_return_type_opt, at cp/parser.c:16970)

	PR c++/56646
	* parser.c (cp_parser_late_return_type_opt): Save and restore
	current_class_ptr/ref.

From-SVN: r196853
parent deaae9d7
2013-03-20 Jason Merrill <jason@redhat.com> 2013-03-20 Jason Merrill <jason@redhat.com>
PR c++/56646
* parser.c (cp_parser_late_return_type_opt): Save and restore
current_class_ptr/ref.
PR c++/54532 PR c++/54532
* expr.c (cplus_expand_constant): Do nothing if the class is * expr.c (cplus_expand_constant): Do nothing if the class is
incomplete. incomplete.
......
...@@ -17056,17 +17056,21 @@ cp_parser_late_return_type_opt (cp_parser* parser, cp_cv_quals quals) ...@@ -17056,17 +17056,21 @@ cp_parser_late_return_type_opt (cp_parser* parser, cp_cv_quals quals)
/* Consume the ->. */ /* Consume the ->. */
cp_lexer_consume_token (parser->lexer); cp_lexer_consume_token (parser->lexer);
tree save_ccp = current_class_ptr;
tree save_ccr = current_class_ref;
if (quals >= 0) if (quals >= 0)
{ {
/* DR 1207: 'this' is in scope in the trailing return type. */ /* DR 1207: 'this' is in scope in the trailing return type. */
gcc_assert (current_class_ptr == NULL_TREE);
inject_this_parameter (current_class_type, quals); inject_this_parameter (current_class_type, quals);
} }
type = cp_parser_trailing_type_id (parser); type = cp_parser_trailing_type_id (parser);
if (quals >= 0) if (quals >= 0)
current_class_ptr = current_class_ref = NULL_TREE; {
current_class_ptr = save_ccp;
current_class_ref = save_ccr;
}
return type; return type;
} }
......
// PR c++/56646
// { dg-require-effective-target c++11 }
struct A {
void f();
};
void A::f() {
struct B {
auto g() -> void { }
};
}
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