This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/14497] New: Accepts invalid specialization of member template missing "template<>"
- From: "giovannibajo at libero dot it" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 9 Mar 2004 01:17:15 -0000
- Subject: [Bug c++/14497] New: Accepts invalid specialization of member template missing "template<>"
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
----------------------------------
template <int N>
struct A {
template<int M> void B () ;
};
// template <> template <>
void A<0>::B<0>()
{
}
----------------------------------
This code snippet should be rejected because it is invalid (the two
specialization headers 'template <>' are commented), but it does not and it is
silently accepted.
The problem *appears* to be in pt.c:maybe_check_template_type:
if (template_header_count <= context_depth)
/* This is OK; the template headers are for the context. We
are actually too lenient here; like
check_explicit_specialization we should consider the number
of template types included in the actual declaration.
but I'm not sure.
--
Summary: Accepts invalid specialization of member template
missing "template<>"
Product: gcc
Version: 3.4.0
Status: UNCONFIRMED
Keywords: accepts-invalid
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: giovannibajo at libero dot it
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14497