Commit 59bce713 by Jason Merrill Committed by Jason Merrill

re PR c++/64129 (ICE on invalid: in grokfndecl, at cp/decl.c:7658)

	PR c++/64129
	* decl.c (grokdeclarator): Recover from variable template
	specialization declared as function.

From-SVN: r218557
parent 9c78f8e6
2014-12-09 Jason Merrill <jason@redhat.com>
PR c++/64129
* decl.c (grokdeclarator): Recover from variable template
specialization declared as function.
PR c++/64222
* parser.c (cp_parser_unqualified_id): Don't declare fname while
parsing function parms.
......
......@@ -10739,6 +10739,19 @@ grokdeclarator (const cp_declarator *declarator,
return error_mark_node;
}
if (TREE_CODE (unqualified_id) == TEMPLATE_ID_EXPR)
{
tree tmpl = TREE_OPERAND (unqualified_id, 0);
if (variable_template_p (tmpl))
{
error ("specialization of variable template %qD "
"declared as function", tmpl);
inform (DECL_SOURCE_LOCATION (tmpl),
"variable template declared here");
return error_mark_node;
}
}
/* Tell grokfndecl if it needs to set TREE_PUBLIC on the node. */
function_context = (ctype != NULL_TREE) ?
decl_function_context (TYPE_MAIN_DECL (ctype)) : NULL_TREE;
......
// PR c++/64129
template <0> int __copy_streambufs_eof; // { dg-error "" }
class {
friend __copy_streambufs_eof <> ( // { dg-error "" }
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