This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
friend template
- From: "Dima Sorkin" <dima dot sorkin at gmail dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Sat, 31 Mar 2007 12:27:44 +0200
- Subject: friend template
Hi.
I have the following error case on gcc 3.4.6. It seems like legal c++.
How can it be overcomed ?
Thank you,
Dima.
-------------------------------------------- code
------------------------------------------------
namespace boost { namespace numeric { namespace ublas {
template<class M> class matrix_row;
template<typename M> void swap (matrix_row<M> mr1, matrix_row<M> mr2);
template<class M> class matrix_row : public ... {
....
friend void swap<> (matrix_row mr1, matrix_row mr2); // line 204
...
};
// definition of swap follows here
...
------------------------------------- error msg
---------------------------------------------
/user_temp/dsorkin/libs/boost_1_33_0/boost/numeric/ublas/matrix_proxy.hpp:204:
error: variable or field `swap' declared void
/user_temp/dsorkin/libs/boost_1_33_0/boost/numeric/ublas/matrix_proxy.hpp:204:
error: `swap' is neither function nor member function; cannot be
declared friend
/user_temp/dsorkin/libs/boost_1_33_0/boost/numeric/ublas/matrix_proxy.hpp:204:
error: expected `;' before '<' token
/user_temp/dsorkin/libs/boost_1_33_0/boost/numeric/ublas/matrix_proxy.hpp:2479:
warning: friend declaration `void
boost::numeric::ublas::swap(boost::numeric::ublas::matrix_range<E>,
boost::numeric::ublas::matrix_range<E>)' declares a non-template
function
----------------------------------- gcc version
-------------------------------------------------
g++ (GCC) 3.4.6 20060404 (Red Hat 3.4.6-3)