[C++ PATCH] Fix PR18825 (forget to complete type used in friend declaration)

Kriang Lerdsuwanakij lerdsuwa@users.sourceforge.net
Wed Dec 8 11:02:00 GMT 2004


Hi

This patch fixes PR18825.  In the following example:

  template<class T> class B
    {
      friend void A<T>::f ();
    };

after 'T' has been substituted, for example with 'int', 
we fail to complete the type of 'A<int>' in order to obtain 
'A<int>::f()'.  There are some more explanation about when
the context must be complete in the comment of 
'tsubst_friend_function' in the attached patch.

Furthermore, the line number of error message produced by
'add_friend' is wrong.  In 'instantiate_class_template', we
call 'tsubst_friend_function' and later 'add_friend'.
The function 'tsubst_friend_function' set and restore the 
'input_location', leaving the subsequent function call to 
'add_friend' the wrong 'input_location'.  This is also
fixed.

Tested on i686-pc-linux-gnu.  OK for mainline?

--Kriang


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: diff-complete-friend-2.txt
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20041208/88574770/attachment.txt>


More information about the Gcc-patches mailing list