Commit 7950124e by Jason Merrill Committed by Jason Merrill

PR c++/79566 - elaborated-type-specifier in range for

	* parser.c (cp_parser_simple_declaration): Fix check for type
	definition.

From-SVN: r245591
parent bea40d11
2017-02-19 Jason Merrill <jason@redhat.com>
PR c++/79566 - elaborated-type-specifier in range for
* parser.c (cp_parser_simple_declaration): Fix check for type
definition.
PR c++/79400 - confusing suggestion of 'noexcept'
* parser.c (cp_parser_exception_specification_opt): Remove
suggestion for deprecated dynamic exception-specification.
......
......@@ -12883,7 +12883,7 @@ cp_parser_simple_declaration (cp_parser* parser,
break;
else if (maybe_range_for_decl)
{
if (declares_class_or_enum && token->type == CPP_COLON)
if ((declares_class_or_enum & 2) && token->type == CPP_COLON)
permerror (decl_specifiers.locations[ds_type_spec],
"types may not be defined in a for-range-declaration");
break;
// PR c++/79566
// { dg-do compile { target c++11 } }
struct X {
struct Y { };
Y* begin();
Y* end();
};
void f()
{
X x;
for (struct X::Y& y : 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