Commit 9ce1594a by Mark Mitchell Committed by Mark Mitchell

re PR c++/15025 (accepts redeclaration of template as non-template)

	PR c++/15025
	* decl.c (xref_tag): Issue errors about redeclaring template
	classes as non-template classes.

	PR c++/15025
	* g++.dg/template/redecl1.C: New test.

From-SVN: r82172
parent f746161e
2004-05-23 Mark Mitchell <mark@codesourcery.com>
PR c++/15025
* decl.c (xref_tag): Issue errors about redeclaring template
classes as non-template classes.
2004-05-23 Mark Mitchell <mark@codesourcery.com>
PR c++/14821
* name-lookup.c (supplement_binding): Allow redefinitions of
namespace aliases.
......
......@@ -9407,6 +9407,13 @@ xref_tag (enum tag_types tag_code, tree name,
{
if (!globalize && processing_template_decl && IS_AGGR_TYPE (t))
redeclare_class_template (t, current_template_parms);
else if (!processing_template_decl
&& CLASS_TYPE_P (t)
&& CLASSTYPE_IS_TEMPLATE (t))
{
error ("redeclaration of `%T' as a non-template", t);
t = error_mark_node;
}
}
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, t);
......
2004-05-23 Mark Mitchell <mark@codesourcery.com>
PR c++/15025
* g++.dg/template/redecl1.C: New test.
2004-05-23 Mark Mitchell <mark@codesourcery.com>
PR c++/14821
* g++.dg/other/ns1.C: New test.
......
// PR c++/15025
template <int> struct X;
struct X {}; // { 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