Commit 8318b14c by Jason Merrill Committed by Jason Merrill

re PR c++/47144 (Doesn't reject attempt to define type in template argument;…

re PR c++/47144 (Doesn't reject attempt to define type in template argument; results in weird parse)

	PR c++/47144
	* parser.c (cp_parser_template_type_arg): Set
	type_definition_forbidden_message.

From-SVN: r170888
parent f231b5ff
2011-03-11 Jason Merrill <jason@redhat.com>
PR c++/47144
* parser.c (cp_parser_template_type_arg): Set
type_definition_forbidden_message.
PR c++/47808
* decl.c (compute_array_index_type): Discard folding
if it didn't produce a constant.
......
......@@ -15685,7 +15685,13 @@ static tree cp_parser_type_id (cp_parser *parser)
static tree cp_parser_template_type_arg (cp_parser *parser)
{
return cp_parser_type_id_1 (parser, true, false);
tree r;
const char *saved_message = parser->type_definition_forbidden_message;
parser->type_definition_forbidden_message
= G_("types may not be defined in template arguments");
r = cp_parser_type_id_1 (parser, true, false);
parser->type_definition_forbidden_message = saved_message;
return r;
}
static tree cp_parser_trailing_type_id (cp_parser *parser)
......
2011-03-11 Jason Merrill <jason@redhat.com>
* g++.dg/parse/no-type-defn1.C: New.
* g++.dg/ext/attrib40.C: New.
* g++.dg/cpp0x/regress/array1.C: New.
......
// PR c++/47144
template<typename> struct A { };
A< struct B { }* >::SomeNonSense // { dg-error "types may not be defined" }
int y;
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