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: Template mangling bug in egcs-2.90.16


> > The question is, whether the compiler is allowed to regard the friend
> > declaration as an ordinary function. I think, this should be a function
> > template and there is a bug in egcs. (See DWP Nov. 96, 14.3.5)
> 
> No.  Guiding decls have been removed from the language.  BTW, there is no
> 14.3.5 in the Nov. 96 WP; what section are you referring to?
> 
> Jason
> 

Oops. Sorry. I refer to the example in section 14.5.3. There is a friend
function, which depends on the template-parameter. This function is
defined as a function-template. 

  14.5.3  Friends                                          [temp.friend]

1 A friend function of a class template can be a function template or an
  ordinary (non-template) function.  [Example:
          template<class T> class task {
              // ...
              friend void next_time();
              friend task<T>* preempt(task<T>*);
              friend task* prmt(task*);           // task is task<T>
              friend class task<int>;
              // ...
          };
  Here,  next_time()  and  task<int> become friends of all task classes,
  and each task has appropriately typed functions preempt()  and  prmt()
  as  friends.   The preempt functions might be defined as a template as
  follows
          template<class T> task<T>* preempt(task<T>* t) { /* ... */ }
   --end example]




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