This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: something wrong with template instantiation mechanics
- To: Oleg Krivosheev <kriol at fnal dot gov>
- Subject: Re: something wrong with template instantiation mechanics
- From: Jason Merrill <jason at cygnus dot com>
- Date: 10 Oct 1997 12:15:52 -0700
- Cc: egcs at cygnus dot com
- References: <Pine.GSO.3.96.971010135321.7378B-100000@drabble>
>>>>> 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