something wrong with template instantiation mechanics
Jason Merrill
jason@cygnus.com
Fri Oct 10 17:19:00 GMT 1997
>>>>> Oleg Krivosheev <kriol@fnal.gov> writes:
> ok, reading again CD2:
> as friends. The preempt functions might be defined as a template as
> follows
> template<class T> task<T>* preempt(task<T>* t) { /* ... */ }
> it looks for me that i'v declared/defined
> abs and op+ in exactly the same manner as proposed in CD2.
That example is out of date, and is not normative in any case. But this is:
14.5.5 Function templates [temp.fct]
2 A function template can be overloaded with other function templates
and with normal (non-template) functions. A normal function is not
related to a function template (i.e., it is never considered to be a
specialization), even if it has the same name and type as a poten-
tially generated function template specialization.3)
_________________________
3) That is, declarations of non-template functions do not merely guide
overload resolution of template functions with the same name. If such
a non-template function is used in a program, it must be defined; it
will not be implicitly instantiated using the function template defi-
nition.
Jason
More information about the Gcc
mailing list