This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: c++/45: Template Specialization
- From: Wolfgang Bangerth <bangerth at ticam dot utexas dot edu>
- To: gcc-bugs at gcc dot gnu dot org, <gcc-gnats at gcc dot gnu dot org>
- Date: Tue, 22 Oct 2002 18:51:23 -0500 (CDT)
- Subject: Re: c++/45: Template Specialization
Someone should re-name this report to
"Matching of partial specialization of classes"
Here's a redux:
-----------------------------------------
template <int N> struct Int {};
template <char C> struct Char{};
template <typename A, typename B> struct X;
template <char C, int N> struct X< Char<C>, Int<N> > { typedef Int<C> val; };
template <int N, char C> struct X< Int<N>, Char<C> > { typedef Int<N> val; };
X< Int<0>, Char<'1'> >::val i;
----------------------------------------
In ways I don't understand, this bug goes away if in the declaration of
the second partial specialization, "int N" and "char C" is reversed,
something that should have absolutely no effect on matching of templates.
In some other ways I do not understand either, the problem also goes away
if I change the template argument of "Char" from "char" to "int",
something that should also not affect matching, but does.
Regards
Wolfgang
-------------------------------------------------------------------------
Wolfgang Bangerth email: bangerth@ticam.utexas.edu
www: http://www.ticam.utexas.edu/~bangerth