Commit 01689517 by Jason Merrill Committed by Jason Merrill

re PR c++/60312 ([c++1y] ICE using auto as template parameter)

	PR c++/60312
	* parser.c (cp_parser_template_type_arg): Check for invalid 'auto'.

From-SVN: r208092
parent ad43b47a
2014-02-24 Jason Merrill <jason@redhat.com>
PR c++/60312
* parser.c (cp_parser_template_type_arg): Check for invalid 'auto'.
2014-02-21 Jason Merrill <jason@redhat.com> 2014-02-21 Jason Merrill <jason@redhat.com>
PR c++/58170 PR c++/58170
......
...@@ -18005,6 +18005,11 @@ static tree cp_parser_template_type_arg (cp_parser *parser) ...@@ -18005,6 +18005,11 @@ static tree cp_parser_template_type_arg (cp_parser *parser)
= G_("types may not be defined in template arguments"); = G_("types may not be defined in template arguments");
r = cp_parser_type_id_1 (parser, true, false); r = cp_parser_type_id_1 (parser, true, false);
parser->type_definition_forbidden_message = saved_message; parser->type_definition_forbidden_message = saved_message;
if (cxx_dialect >= cxx1y && type_uses_auto (r))
{
error ("invalid use of %<auto%> in template argument");
r = error_mark_node;
}
return r; return r;
} }
......
// PR c++/60312
// { dg-options -std=c++1y }
template<typename> struct A;
template<> struct A<auto> // { dg-error "auto|template argument" }
{
template<int> void foo();
};
void bar()
{
A<auto>().foo<0>(); // { dg-error "auto|template argument" }
}
// { dg-prune-output "expected" }
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