This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: something wrong with template instantiation mechanics


>>>>> 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]