mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-02-12 02:19:56 +08:00
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
This commit is contained in:
parent
f746161e4f
commit
9ce1594a3e
@ -1,3 +1,9 @@
|
||||
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
|
||||
|
@ -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);
|
||||
|
@ -1,3 +1,8 @@
|
||||
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
|
||||
|
4
gcc/testsuite/g++.dg/template/redecl1.C
Normal file
4
gcc/testsuite/g++.dg/template/redecl1.C
Normal file
@ -0,0 +1,4 @@
|
||||
// PR c++/15025
|
||||
|
||||
template <int> struct X;
|
||||
struct X {}; // { dg-error "" }
|
Loading…
Reference in New Issue
Block a user