This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c++/8665: explicit specialization of the member class template of a class template
- From: jozef dot kosoru at pobox dot sk
- To: gcc-gnats at gcc dot gnu dot org
- Date: 21 Nov 2002 09:29:59 -0000
- Subject: c++/8665: explicit specialization of the member class template of a class template
- Reply-to: jozef dot kosoru at pobox dot sk
>Number: 8665
>Category: c++
>Synopsis: explicit specialization of the member class template of a class template
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: rejects-legal
>Submitter-Id: net
>Arrival-Date: Thu Nov 21 01:36:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator: Jozef Kosoru
>Release: g++-3.2
>Organization:
>Environment:
Linux
>Description:
The following code does not compile on g++-3.2 and gives a very strange error message.
But according ISO explicit specialization of the member class template of a class template is allowed.
--------------------------------------------------------
template<class T_>
struct A
{
template<class X_>
struct B
{
typedef X_ my_type;
};
template<>
struct B<char>
{
typedef int my_type;
};
};
int main()
{
A<int>::B<double>::my_type i;
A<int>::B<char>::my_type c;
}
--------------------------------------------------------
refer 14.7.3 (Explicit specialization):
An explicit specialization of any of the following:
...
- member class template of a class template
...
can be declared by a declaration introduced by template<>...
exptmpl.cpp:15: explicit specialization in non-namespace scope `struct A<T_>'
exptmpl.cpp:15: enclosing class templates are not explicitly specialized
exptmpl.cpp:17: template parameters not used in partial specialization:
exptmpl.cpp:17: `T_'
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: