c++/8665: explicit specialization of the member class template of a class template

jozef.kosoru@pobox.sk jozef.kosoru@pobox.sk
Thu Nov 21 02:53:00 GMT 2002


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



More information about the Gcc-bugs mailing list