This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/14497] New: Accepts invalid specialization of member template missing "template<>"


----------------------------------
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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]