GCC 2.95.2, Next 3.3; Reference causes error in pickingspecialization

Martin v. Loewis martin@loewis.home.cs.tu-berlin.de
Sun Feb 6 03:52:00 GMT 2000


> Enclosed program demonstrates that when an explicit specialization
> uses pass by reference, the non-specialized template is picked

Thanks for your bug report. I fail to see the bug, though. The
compiler correctly invokes A::A<int>(int). To determine which
constructor is used, overload resolution is performed. 

First, all candidates are collected, which only finds the template
ctor. Then, template argument deduction is performed for the template
arguments, which determines T=int. Then, those templates are
instantiated, and the best viable candidate is selected, which will be
the T=int candidate (i.e. the only one). Therefore, the explicit
specialization is never used.

If you have further questions about C++ semantics (or if you question
my explanation), please use one of the C++ fora (such as
comp.lang.c++.moderated). If you still think there is a bug in g++,
please provide the relevant references to the standard.

Regards,
Martin


More information about the Gcc-bugs mailing list