This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c++/8806: gcc accepts bad argument for template template parameter
- From: catherin at ca dot ibm dot com
- To: gcc-gnats at gcc dot gnu dot org
- Date: 4 Dec 2002 14:12:14 -0000
- Subject: c++/8806: gcc accepts bad argument for template template parameter
- Reply-to: catherin at ca dot ibm dot com
>Number: 8806
>Category: c++
>Synopsis: gcc accepts bad argument for template template parameter
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Dec 04 06:16:29 PST 2002
>Closed-Date:
>Last-Modified:
>Originator: Catherine Morton
>Release: unknown-1.0
>Organization:
>Environment:
GNU C++ version 3.2 (powerpc-suse-linux)
>Description:
// --------------------------------------------
template < template <class A> class B> class foo{};
template < class C > class bar
{
foo<bar> x;
};
bar<int> test;
// ---------------------------------------------
This is invalid according to section 14.6.1 paragraph 2
"Within the scope of a class template specialization or partial specialization, when the
name of the template is neither qualified nor followed by <, it is equivalent to the name of the
template followed by the template-arguments enclosed in <>."
So, in the specialization bar<int> the reference bar is actually bar<int> which does not
match the template template parameter in class foo...
>How-To-Repeat:
// --------------------------------------------
template < template <class A> class B> class foo{};
template < class C > class bar
{
foo<bar> x;
};
bar<int> test;
// ---------------------------------------------
g++ small.cpp
> > no errors
should issue an error message such as:
"small.cpp", line 5.8: 1540-0716 (S) The template argument "bar<int>" does not match the template parameter "template class B".
"small.cpp", line 8.10: 1540-0700 (I) The previous message was produced while processing "class bar<int>".
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: