Multivariate Partial Specialization Broken?

John McCorquodale mcq@eroica.cs.utah.edu
Thu May 7 20:49:00 GMT 1998


Would somebody tell me if this is a bug?  The following is an example of
template specialization that works in egcs-1.0.2:

  template<int i> inline int bob(void) { return 2; }
  template<> inline int bob<0>(void) { return 3; }

I would expect the following to work, but it yields an "Internal compiler
error":

  template<int n,int i> inline int bob(void) { return 2; }
  template<int n> inline int bob<n,0>(void) { return 3; }

The only difference between the second and the first is that introduction of
an unused second template parameter.  In the second case, I'd like the
specialized function to be used in all <_don't_care_,0> situations.

Multivariate template specialization syntax is conspicuously not covered
in Stroustrup's book.  If I'm just being stupid, feel free to call me names,
as long as you clue me in in the process.  ;-)

Thanks, y'all,

-mcq



More information about the Gcc-bugs mailing list